MCPcopy Index your code
hub / github.com/bqplot/bqplot / _mark_with_data

Function _mark_with_data

bqplot/pyplot.py:204–221  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

202 def _data_decorator(func):
203 @functools.wraps(func)
204 def _mark_with_data(*args, **kwargs):
205 data = kwargs.pop('data', None)
206 if data is None:
207 return func(*args, **kwargs)
208 else:
209 data_args = [data[i] if hashable(data, i) else i for i in args]
210 data_kwargs = {
211 kw: data[kwargs[kw]] if hashable(data, kwargs[kw]) else kwargs[kw] for kw in set(kwarg_names).intersection(list(kwargs.keys()))
212 }
213 try:
214 # if any of the plots want to use the index_data, they can
215 # use it by referring to this attribute.
216 data_kwargs['index_data'] = data.index
217 except AttributeError:
218 pass
219 kwargs_update = kwargs.copy()
220 kwargs_update.update(data_kwargs)
221 return func(*data_args, **kwargs_update)
222
223 return _mark_with_data
224 return _data_decorator

Callers

nothing calls this directly

Calls 2

hashableFunction · 0.85
updateMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…