MCPcopy Create free account
hub / github.com/holoviz/hvplot / __new__

Method __new__

hvplot/interactive.py:216–233  ·  view source on GitHub ↗
(cls, obj, **kwargs)

Source from the content-addressed store, hash-verified

214 _fig = None
215
216 def __new__(cls, obj, **kwargs):
217 # __new__ implemented to support functions as input, e.g.
218 # hvplot.find(foo, widget).interactive().max()
219 if 'fn' in kwargs:
220 fn = kwargs.pop('fn')
221 elif isinstance(obj, (FunctionType, MethodType)):
222 fn = pn.panel(obj, lazy=True)
223 obj = fn.eval(obj)
224 else:
225 fn = None
226 clss = cls
227 for subcls in cls.__subclasses__():
228 if subcls.applies(obj):
229 clss = subcls
230 inst = super().__new__(clss)
231 inst._shared_obj = kwargs.get('_shared_obj', [obj])
232 inst._fn = fn
233 return inst
234
235 @classmethod
236 def applies(cls, obj):

Callers

nothing calls this directly

Calls 3

panelMethod · 0.80
evalMethod · 0.80
appliesMethod · 0.45

Tested by

no test coverage detected