From 045e2975b77336492ccd86007cb9d299335eceaa Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Mon, 6 Jan 2014 11:32:10 -0500 Subject: [PATCH] MAINT: Remove type checking which trip up Python 3 compatibility. Instead of porting these cases of type checking, remove them instead. Slightly more Python-ic to be more generous in what is allowed, and the conversion to make these compatible with Python 3 are more trouble than they are worth. --- zipline/gens/utils.py | 4 ---- zipline/transforms/utils.py | 3 --- 2 files changed, 7 deletions(-) diff --git a/zipline/gens/utils.py b/zipline/gens/utils.py index 585f5ce1..9bd8f2c5 100644 --- a/zipline/gens/utils.py +++ b/zipline/gens/utils.py @@ -39,7 +39,6 @@ def hash_args(*args, **kwargs): def assert_datasource_protocol(event): """Assert that an event meets the protocol for datasource outputs.""" - assert isinstance(event.source_id, basestring) assert event.type in DATASOURCE_TYPE # Done packets have no dt. @@ -61,17 +60,14 @@ def assert_trade_protocol(event): def assert_datasource_unframe_protocol(event): """Assert that an event is valid output of zp.DATASOURCE_UNFRAME.""" - assert isinstance(event.source_id, basestring) assert event.type in DATASOURCE_TYPE def assert_sort_protocol(event): """Assert that an event is valid input to zp.FEED_FRAME.""" - assert isinstance(event.source_id, basestring) assert event.type in DATASOURCE_TYPE def assert_sort_unframe_protocol(event): """Same as above.""" - assert isinstance(event.source_id, basestring) assert event.type in DATASOURCE_TYPE diff --git a/zipline/transforms/utils.py b/zipline/transforms/utils.py index 8f6d6801..bccff29d 100644 --- a/zipline/transforms/utils.py +++ b/zipline/transforms/utils.py @@ -17,7 +17,6 @@ """ Generator versions of transforms. """ -import types import logbook @@ -92,8 +91,6 @@ class StatefulTransform(object): Otherwise only dt, tnfm_id, and tnfm_value are forwarded. """ def __init__(self, tnfm_class, *args, **kwargs): - assert isinstance(tnfm_class, (types.ObjectType, types.ClassType)), \ - "Stateful transform requires a class." assert hasattr(tnfm_class, 'update'), \ "Stateful transform requires the class to have an update method"