mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-17 11:16:40 +08:00
MAINT: Use Python 3 compatible metaclass.
Use six's with_metaclass to have objects that use metaclasses, in both Python 2 and 3. Otherwise, in Python 3 the objects were being treated as if they did not have a metaclass, when the Python 2 syntax is used, leading to errors because of missing attributes, etc.
This commit is contained in:
@@ -26,6 +26,8 @@ from datetime import datetime
|
||||
from collections import deque
|
||||
from abc import ABCMeta, abstractmethod
|
||||
|
||||
from six import with_metaclass
|
||||
|
||||
from zipline.protocol import DATASOURCE_TYPE
|
||||
from zipline.gens.utils import assert_sort_unframe_protocol, hash_args
|
||||
from zipline.finance import trading
|
||||
@@ -147,7 +149,7 @@ class StatefulTransform(object):
|
||||
yield out_message
|
||||
|
||||
|
||||
class EventWindow(object):
|
||||
class EventWindow(with_metaclass(ABCMeta)):
|
||||
"""
|
||||
Abstract base class for transform classes that calculate iterative
|
||||
metrics on events within a given timedelta. Maintains a list of
|
||||
@@ -166,7 +168,6 @@ class EventWindow(object):
|
||||
price.
|
||||
"""
|
||||
# Mark this as an abstract base class.
|
||||
__metaclass__ = ABCMeta
|
||||
|
||||
def __init__(self, market_aware=True, window_length=None, delta=None):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user