From 7c58bf1e5b014d5bedf16de1abd605d90f726992 Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Wed, 14 Sep 2016 14:45:00 -0400 Subject: [PATCH] STY: Flake8 and parameter rename. --- zipline/pipeline/engine.py | 3 ++- zipline/pipeline/graph.py | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/zipline/pipeline/engine.py b/zipline/pipeline/engine.py index e17331a3..4bb6f6b0 100644 --- a/zipline/pipeline/engine.py +++ b/zipline/pipeline/engine.py @@ -382,7 +382,8 @@ class SimplePipelineEngine(object): else: assert workspace[term].shape == (mask.shape[0], 1) - # Decref dependencies of ``term``, and clear any terms whose refcounts hit 0. + # Decref dependencies of ``term``, and clear any terms whose + # refcounts hit 0. for garbage_term in graph.decref_dependencies(term, refcounts): del workspace[garbage_term] diff --git a/zipline/pipeline/graph.py b/zipline/pipeline/graph.py index 78dffc14..667c3be9 100644 --- a/zipline/pipeline/graph.py +++ b/zipline/pipeline/graph.py @@ -119,10 +119,15 @@ class TermGraph(DiGraph): def _repr_png_(self): return self.png.data - def initial_refcounts(self, initial_workspace): + def initial_refcounts(self, initial_terms): """ Calculate initial refcounts for execution of this graph. + Parameters + ---------- + initial_terms : iterable[Term] + An iterable of terms that were pre-computed before graph execution. + Each node starts with a refcount equal to its outdegree, and output nodes get one extra reference to ensure that they're still in the graph at the end of execution. @@ -131,7 +136,7 @@ class TermGraph(DiGraph): for t in self.outputs.values(): refcounts[t] += 1 - for t in initial_workspace: + for t in initial_terms: self.decref_dependencies(t, refcounts) return refcounts