STY: remove unused imports and method, clean up docs

This commit is contained in:
Joe Jevnik
2016-10-14 12:57:13 -04:00
parent af3e1016a0
commit d07f133579
5 changed files with 40 additions and 16 deletions
+1 -1
View File
@@ -520,7 +520,7 @@ class TestPostProcessAndToWorkSpaceValue(ZiplineTestCase):
missing_value = -1
f = F()
column_data =np.array(
column_data = np.array(
[[0, f.missing_value],
[1, f.missing_value],
[2, 3]],
+1 -1
View File
@@ -34,7 +34,7 @@ from pandas import (
from pandas.compat.chainmap import ChainMap
from pandas.util.testing import assert_frame_equal
from six import iteritems, itervalues
from toolz import merge, assoc
from toolz import merge
from zipline.assets.synthetic import make_rotating_equity_info
from zipline.errors import NoFurtherDataError
+38 -10
View File
@@ -81,11 +81,36 @@ class ExplodingPipelineEngine(PipelineEngine):
)
def _default_populate_initial_workspace(initial_workspace,
root_mask_term,
execution_plan,
dates,
assets):
def default_populate_initial_workspace(initial_workspace,
root_mask_term,
execution_plan,
dates,
assets):
"""The default implementation for ``populate_initial_workspace``. This
function returns the ``initial_workspace`` argument without making any
modifications.
Parameters
----------
initial_workspace : dict[array-like]
The initial workspace before we have populated it with any cached
terms.
root_mask_term : Term
The root mask term, normally ``AssetExists()``. This is needed to
compute the dates for individual terms.
execution_plan : ExecutionPlan
The execution plan for the pipeline being run.
dates : pd.DatetimeIndex
All of the dates being requested in this pipeline run including
the extra dates for look back windows.
assets : pd.Int64Index
All of the assets that exist for the window being computed.
Returns
-------
populated_initial_workspace : dict[term, array-like]
The workspace to begin computations with.
"""
return initial_workspace
@@ -106,10 +131,13 @@ class SimplePipelineEngine(object):
which assets are in the top-level universe at any point in time.
populate_initial_workspace : callable, optional
A function which will be used to populate the initial workspace when
computing a pipeline. This function will be passed the
initial_workspace, the root mask term, the execution_plan, the dates
being computed for, and the assets requested and should return a new
dictionary which will be used as the initial_workspace.
computing a pipeline. See
:func:`zipline.pipeline.engine.default_populate_initial_workspace`
for more info.
See Also
--------
:func:`zipline.pipeline.engine.default_populate_initial_workspace`
"""
__slots__ = (
'_get_loader',
@@ -134,7 +162,7 @@ class SimplePipelineEngine(object):
self._root_mask_dates_term = InputDates()
self._populate_initial_workspace = (
populate_initial_workspace or _default_populate_initial_workspace
populate_initial_workspace or default_populate_initial_workspace
)
def run_pipeline(self, pipeline, start_date, end_date):
-3
View File
@@ -195,9 +195,6 @@ class TermGraph(object):
garbage.add(parent)
return garbage
def __iter__(self):
return iter(self.graph)
class ExecutionPlan(TermGraph):
"""
-1
View File
@@ -492,7 +492,6 @@ assert_index_equal = _register_assert_equal_wrapper(
)
@assert_equal.register(pd.Categorical, pd.Categorical)
def assert_categorical_equal(result, expected, path=(), msg='', **kwargs):
assert_equal(