Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Custom getattribute to expose user defined subplots.
"""
plots = object.__getattribute__(self, '_plots')
if name in plots:
plot_opts = plots[name]
if 'kind' in plot_opts and name in HoloViewsConverter._kind_mapping:
param.main.warning("Custom options for existing plot types should not "
"declare the 'kind' argument. The .%s plot method "
"was unexpectedly customized with kind=%r."
% (plot_opts['kind'], name))
plot_opts['kind'] = name
return hvPlotBase(self._data, **dict(self._metadata, **plot_opts))
return super(hvPlotBase, self).__getattribute__(name)
class hvPlotTabular(hvPlotBase):
__all__ = [
'line',
'step',
'scatter',
'area',
'errorbars',
'heatmap',
'hexbin',
'bivariate',
'bar',
'barh',
'box',
'violin',
'hist',
'kde',
'density',
def __dir__(self):
"""
List default attributes and custom defined plots.
"""
dirs = super(hvPlotBase, self).__dir__()
return sorted(list(dirs)+list(self._plots))
def __getattribute__(self, name):
"""
Custom getattribute to expose user defined subplots.
"""
plots = object.__getattribute__(self, '_plots')
if name in plots:
plot_opts = plots[name]
if 'kind' in plot_opts and name in HoloViewsConverter._kind_mapping:
param.main.warning("Custom options for existing plot types should not "
"declare the 'kind' argument. The .%s plot method "
"was unexpectedly customized with kind=%r."
% (plot_opts['kind'], name))
plot_opts['kind'] = name
return hvPlotBase(self._data, **dict(self._metadata, **plot_opts))
return super(hvPlotBase, self).__getattribute__(name)