Skip to content

Commit

Permalink
standardize names of args to pipelined_call
Browse files Browse the repository at this point in the history
  • Loading branch information
jonmmease committed Sep 18, 2019
1 parent 2adf704 commit 7ea2ba5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions holoviews/core/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,31 @@ def __new__(mcs, classname, bases, classdict):

@classmethod
def pipelined(mcs, __call__):
def pipelined_call(*a, **k):
def pipelined_call(*args, **kwargs):
from .data import Dataset, MultiDimensionalMapping
inst = a[0]
inst = args[0]
if not hasattr(inst._obj, '_pipeline'):
# Wrapped object doesn't support the pipeline property
return __call__(*a, **k)
return __call__(*args, **kwargs)

in_method = inst._obj._in_method
if not in_method:
inst._obj._in_method = True

result = __call__(*a, **k)
result = __call__(*args, **kwargs)

if not in_method:
mode = getattr(inst, 'mode', None)
if isinstance(result, Dataset):
result._pipeline = inst._obj._pipeline + [
(type(inst), [], {'mode': mode}),
(__call__, list(a[1:]), k)
(__call__, list(args[1:]), kwargs)
]
elif isinstance(result, MultiDimensionalMapping):
for key, element in result.items():
element._pipeline = inst._obj._pipeline + [
(type(inst), [], {'mode': mode}),
(__call__, list(a[1:]), k),
(__call__, list(args[1:]), kwargs),
(getattr(type(result), '__getitem__'), [key], {})
]
inst._obj._in_method = False
Expand Down
10 changes: 5 additions & 5 deletions holoviews/core/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,23 @@ def __new__(mcs, classname, bases, classdict):

@staticmethod
def pipelined(method):
def pipelined_fn(*a, **k):
inst = a[0]
def pipelined_fn(*args, **kwargs):
inst = args[0]
in_method = inst._in_method
if not in_method:
inst._in_method = True

result = method(*a, **k)
result = method(*args, **kwargs)

if not in_method:
if isinstance(result, Dataset):
result._pipeline = inst._pipeline + [
(method, list(a[1:]), k)
(method, list(args[1:]), kwargs)
]
elif isinstance(result, MultiDimensionalMapping):
for key, element in result.items():
element._pipeline = inst._pipeline + [
(method, list(a[1:]), k),
(method, list(args[1:]), kwargs),
(getattr(type(result), '__getitem__'), [key], {})
]
inst._in_method = False
Expand Down

0 comments on commit 7ea2ba5

Please sign in to comment.