Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Change ObjectSelector to Selector #6444

Merged
merged 2 commits into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion holoviews/core/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ class FileArchive(Archive):
The root directory in which the output directory is
located. May be an absolute or relative path.""")

archive_format = param.ObjectSelector(default='zip', objects=['zip', 'tar'], doc="""
archive_format = param.Selector(default='zip', objects=['zip', 'tar'], doc="""
The archive format to use if there are multiple files and pack
is set to True. Supported formats include 'zip' and 'tar'.""")

Expand Down
2 changes: 1 addition & 1 deletion holoviews/core/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Operation(param.ParameterizedFunction):
The group string used to identify the output of the
Operation. By default this should match the operation name.""")

dynamic = param.ObjectSelector(default='default',
dynamic = param.Selector(default='default',
objects=['default', True, False], doc="""
Whether the operation should be applied dynamically when a
specific frame is requested, specified as a Boolean. If set to
Expand Down
2 changes: 1 addition & 1 deletion holoviews/core/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ class Compositor(param.Parameterized):
values names of those matrices match 'R', 'G' and 'B'.
"""

mode = param.ObjectSelector(default='data',
mode = param.Selector(default='data',
objects=['data', 'display'], doc="""
The mode of the Compositor object which may be either 'data' or
'display'.""")
Expand Down
8 changes: 4 additions & 4 deletions holoviews/element/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,12 +368,12 @@ class Arrow(Annotation):

text = param.String(default='', doc="Text associated with the arrow.")

direction = param.ObjectSelector(default='<',
direction = param.Selector(default='<',
objects=['<', '^', '>', 'v'], doc="""
The cardinal direction in which the arrow is pointing. Accepted
arrow directions are '<', '^', '>' and 'v'.""")

arrowstyle = param.ObjectSelector(default='->',
arrowstyle = param.Selector(default='->',
objects=['-', '->', '-[', '-|>', '<->', '<|-|>'],
doc="""
The arrowstyle used to draw the arrow. Accepted arrow styles are
Expand Down Expand Up @@ -442,12 +442,12 @@ class Text(Annotation):

rotation = param.Number(default=0, doc="Text rotation angle in degrees.")

halign = param.ObjectSelector(default='center',
halign = param.Selector(default='center',
objects=['left', 'right', 'center'], doc="""
The horizontal alignment position of the displayed text. Allowed values
are 'left', 'right' and 'center'.""")

valign = param.ObjectSelector(default='center',
valign = param.Selector(default='center',
objects=['top', 'bottom', 'center'], doc="""
The vertical alignment position of the displayed text. Allowed values
are 'center', 'top' and 'bottom'.""")
Expand Down
2 changes: 1 addition & 1 deletion holoviews/ipython/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ProgressBar(ProgressIndicator):
progress bars has not achieved 100% completion.
"""

display = param.ObjectSelector(default='stdout',
display = param.Selector(default='stdout',
objects=['stdout', 'disabled', 'broadcast'], doc="""
Parameter to control display of the progress bar. By default,
progress is shown on stdout but this may be disabled e.g. for
Expand Down
12 changes: 6 additions & 6 deletions holoviews/operation/datashader.py
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ class regrid(AggregationOperation):
be faster and use less memory if the resulting aggregate is
being overlaid on a much larger background.""")

interpolation = param.ObjectSelector(default='nearest',
interpolation = param.Selector(default='nearest',
objects=['linear', 'nearest', 'bilinear', None, False], doc="""
Interpolation method""")

Expand Down Expand Up @@ -981,7 +981,7 @@ class trimesh_rasterize(aggregate):
aggregator = param.ClassSelector(default=rd.mean(),
class_=(rd.Reduction, rd.summary, str))

interpolation = param.ObjectSelector(default='bilinear',
interpolation = param.Selector(default='bilinear',
objects=['bilinear', 'linear', None, False], doc="""
The interpolation method to apply during rasterization.""")

Expand Down Expand Up @@ -1475,7 +1475,7 @@ class rasterize(AggregationOperation):
aggregator = param.ClassSelector(class_=(rd.Reduction, rd.summary, str),
default='default')

interpolation = param.ObjectSelector(
interpolation = param.Selector(
default='default', objects=['default', 'linear', 'nearest', 'bilinear', None, False], doc="""
The interpolation method to apply during rasterization.
Default depends on element type""")
Expand Down Expand Up @@ -1575,7 +1575,7 @@ class stack(Operation):
the defined compositing operator.
"""

compositor = param.ObjectSelector(objects=['add', 'over', 'saturate', 'source'],
compositor = param.Selector(objects=['add', 'over', 'saturate', 'source'],
default='over', doc="""
Defines how the compositing operation combines the images""")

Expand Down Expand Up @@ -1633,13 +1633,13 @@ class SpreadingOperation(LinkableOperation):
to make sparse plots more visible.
"""

how = param.ObjectSelector(default='source' if DATASHADER_VERSION <= (0, 11, 1) else None,
how = param.Selector(default='source' if DATASHADER_VERSION <= (0, 11, 1) else None,
objects=[None, 'source', 'over', 'saturate', 'add', 'max', 'min'], doc="""
The name of the compositing operator to use when combining
pixels. Default of None uses 'over' operator for RGB elements
and 'add' operator for aggregate arrays.""")

shape = param.ObjectSelector(default='circle', objects=['circle', 'square'],
shape = param.Selector(default='circle', objects=['circle', 'square'],
doc="""
The shape to spread by. Options are 'circle' [default] or 'square'.""")

Expand Down
4 changes: 2 additions & 2 deletions holoviews/operation/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ class histogram(Operation):
mean_weighted = param.Boolean(default=False, doc="""
Whether the weighted frequencies are averaged.""")

normed = param.ObjectSelector(default=False,
normed = param.Selector(default=False,
objects=[True, False, 'integral', 'height'],
doc="""
Controls normalization behavior. If `True` or `'integral'`, then
Expand Down Expand Up @@ -1023,7 +1023,7 @@ class interpolate_curve(Operation):
to represent changes in y-values as steps.
"""

interpolation = param.ObjectSelector(objects=['steps-pre', 'steps-mid',
interpolation = param.Selector(objects=['steps-pre', 'steps-mid',
'steps-post', 'linear'],
default='steps-mid', doc="""
Controls the transition point of the step along the x-axis.""")
Expand Down
4 changes: 2 additions & 2 deletions holoviews/operation/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class univariate_kde(Operation):
using the bw_method but it may be overridden by an explicit value.
"""

bw_method = param.ObjectSelector(default='scott', objects=['scott', 'silverman'], doc="""
bw_method = param.Selector(default='scott', objects=['scott', 'silverman'], doc="""
Method of automatically determining KDE bandwidth""")

bandwidth = param.Number(default=None, doc="""
Expand Down Expand Up @@ -138,7 +138,7 @@ class bivariate_kde(Operation):
Whether to compute contours from the KDE, determines whether to
return an Image or Contours/Polygons.""")

bw_method = param.ObjectSelector(default='scott', objects=['scott', 'silverman'], doc="""
bw_method = param.Selector(default='scott', objects=['scott', 'silverman'], doc="""
Method of automatically determining KDE bandwidth""")

bandwidth = param.Number(default=None, doc="""
Expand Down
6 changes: 3 additions & 3 deletions holoviews/operation/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class rolling(Operation,RollingBase):
Applies a function over a rolling window.
"""

window_type = param.ObjectSelector(default=None, allow_None=True,
window_type = param.Selector(default=None, allow_None=True,
objects=['boxcar', 'triang', 'blackman', 'hamming', 'bartlett',
'parzen', 'bohman', 'blackmanharris', 'nuttall',
'barthann', 'kaiser', 'gaussian', 'general_gaussian',
Expand Down Expand Up @@ -69,13 +69,13 @@ class resample(Operation):
Resamples a timeseries of dates with a frequency and function.
"""

closed = param.ObjectSelector(default=None, objects=['left', 'right'],
closed = param.Selector(default=None, objects=['left', 'right'],
doc="Which side of bin interval is closed", allow_None=True)

function = param.Callable(default=np.mean, doc="""
Function for computing new values out of existing ones.""")

label = param.ObjectSelector(default='right', doc="""
label = param.Selector(default='right', doc="""
The bin edge to label the bin with.""")

rule = param.String(default='D', doc="""
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ class DivPlot(BokehPlot, GenericElementPlot, AnnotationPlot):

width = param.Number(default=300)

sizing_mode = param.ObjectSelector(default=None, objects=[
sizing_mode = param.Selector(default=None, objects=[
'fixed', 'stretch_width', 'stretch_height', 'stretch_both',
'scale_width', 'scale_height', 'scale_both', None], doc="""

Expand Down
10 changes: 5 additions & 5 deletions holoviews/plotting/bokeh/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class PointPlot(LegendPlot, ColorbarPlot):
allow_None=True, doc="""
Deprecated in favor of size style mapping, e.g. `size=dim('size')`""")

scaling_method = param.ObjectSelector(default="area",
scaling_method = param.Selector(default="area",
objects=["width", "area"],
doc="""
Deprecated in favor of size style mapping, e.g.
Expand Down Expand Up @@ -195,7 +195,7 @@ class VectorFieldPlot(ColorbarPlot):

padding = param.ClassSelector(default=0.05, class_=(int, float, tuple))

pivot = param.ObjectSelector(default='mid', objects=['mid', 'tip', 'tail'],
pivot = param.Selector(default='mid', objects=['mid', 'tip', 'tail'],
doc="""
The point around which the arrows should pivot valid options
include 'mid', 'tip' and 'tail'.""")
Expand Down Expand Up @@ -344,7 +344,7 @@ class CurvePlot(ElementPlot):

padding = param.ClassSelector(default=(0, 0.1), class_=(int, float, tuple))

interpolation = param.ObjectSelector(objects=['linear', 'steps-mid',
interpolation = param.Selector(objects=['linear', 'steps-mid',
'steps-pre', 'steps-post'],
default='linear', doc="""
Defines how the samples of the Curve are interpolated,
Expand Down Expand Up @@ -743,14 +743,14 @@ class SideSpikesPlot(SpikesPlot):
The current selection as a list of integers corresponding
to the selected items.""")

xaxis = param.ObjectSelector(default='top-bare',
xaxis = param.Selector(default='top-bare',
objects=['top', 'bottom', 'bare', 'top-bare',
'bottom-bare', None], doc="""
Whether and where to display the xaxis, bare options allow suppressing
all axis labels including ticks and xlabel. Valid options are 'top',
'bottom', 'bare', 'top-bare' and 'bottom-bare'.""")

yaxis = param.ObjectSelector(default='right-bare',
yaxis = param.Selector(default='right-bare',
objects=['left', 'right', 'bare', 'left-bare',
'right-bare', None], doc="""
Whether and where to display the yaxis, bare options allow suppressing
Expand Down
16 changes: 8 additions & 8 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ class ElementPlot(BokehPlot, GenericElementPlot):
listed only the last one will be active. As a default 'pan'
and 'wheel_zoom' will be used if the tools are enabled.""")

align = param.ObjectSelector(default='start', objects=['start', 'center', 'end'], doc="""
align = param.Selector(default='start', objects=['start', 'center', 'end'], doc="""
Alignment (vertical or horizontal) of the plot in a layout.""")

apply_hard_bounds = param.Boolean(default=False, doc="""
If True, the navigable bounds of the plot will be set based
on the more extreme of extents between the data or xlim/ylim ranges.
If dim ranges are set, the hard bounds will be set to the dim ranges.""")

autorange = param.ObjectSelector(default=None, objects=['x', 'y', None], doc="""
autorange = param.Selector(default=None, objects=['x', 'y', None], doc="""
Whether to auto-range along either the x- or y-axis, i.e.
when panning or zooming along the orthogonal axis it will
ensure all the data along the selected axis remains visible.""")
Expand Down Expand Up @@ -258,7 +258,7 @@ class ElementPlot(BokehPlot, GenericElementPlot):
subcoordinate_scale = param.Number(default=1, bounds=(0, None), inclusive_bounds=(False, True), doc="""
Scale factor for subcoordinate ranges to control the level of overlap.""")

responsive = param.ObjectSelector(default=False, objects=[False, True, 'width', 'height'])
responsive = param.Selector(default=False, objects=[False, True, 'width', 'height'])

fontsize = param.Parameter(default={'title': '12pt'}, allow_None=True, doc="""
Specifies various fontsizes of the displayed text.
Expand Down Expand Up @@ -310,7 +310,7 @@ class ElementPlot(BokehPlot, GenericElementPlot):
hover_formatters = param.Dict(doc="""
A dict of formatting options for the hover tooltip.""")

hover_mode = param.ObjectSelector(default='mouse', objects=['mouse', 'vline', 'hline'], doc="""
hover_mode = param.Selector(default='mouse', objects=['mouse', 'vline', 'hline'], doc="""
The hover mode determines how the hover tool is activated.""")

xticks = param.ClassSelector(class_=(int, list, tuple, np.ndarray, Ticker), default=None, doc="""
Expand All @@ -323,7 +323,7 @@ class ElementPlot(BokehPlot, GenericElementPlot):
tick locations, or bokeh Ticker object. If set to None default
bokeh ticking behavior is applied.""")

toolbar = param.ObjectSelector(default='right',
toolbar = param.Selector(default='right',
objects=["above", "below",
"left", "right", "disable", None],
doc="""
Expand Down Expand Up @@ -2670,13 +2670,13 @@ class ColorbarPlot(ElementPlot):
numerical percentile value.""")


cnorm = param.ObjectSelector(default='linear', objects=['linear', 'log', 'eq_hist'], doc="""
cnorm = param.Selector(default='linear', objects=['linear', 'log', 'eq_hist'], doc="""
Color normalization to be applied during colormapping.""")

colorbar = param.Boolean(default=False, doc="""
Whether to display a colorbar.""")

colorbar_position = param.ObjectSelector(objects=list(colorbar_specs),
colorbar_position = param.Selector(objects=list(colorbar_specs),
default="right", doc="""
Allows selecting between a number of predefined colorbar position
options. The predefined options may be customized in the
Expand Down Expand Up @@ -2985,7 +2985,7 @@ class LegendPlot(ElementPlot):
If legend is placed outside the axis, this determines the
(width, height) offset in pixels from the original position.""")

legend_position = param.ObjectSelector(objects=["top_right",
legend_position = param.Selector(objects=["top_right",
"top_left",
"bottom_left",
"bottom_right",
Expand Down
4 changes: 2 additions & 2 deletions holoviews/plotting/bokeh/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class GraphPlot(GraphMixin, CompositeElementPlot, ColorbarPlot, LegendPlot):
Whether to draw arrows on the graph edges to indicate the
directionality of each edge.""")

selection_policy = param.ObjectSelector(default='nodes', objects=['edges', 'nodes', None], doc="""
selection_policy = param.Selector(default='nodes', objects=['edges', 'nodes', None], doc="""
Determines policy for inspection of graph components, i.e. whether to highlight
nodes or edges when selecting connected edges and nodes respectively.""")

inspection_policy = param.ObjectSelector(default='nodes', objects=['edges', 'nodes', None], doc="""
inspection_policy = param.Selector(default='nodes', objects=['edges', 'nodes', None], doc="""
Determines policy for inspection of graph components, i.e. whether to highlight
nodes or edges when hovering over connected edges and nodes respectively.""")

Expand Down
4 changes: 2 additions & 2 deletions holoviews/plotting/bokeh/hex_tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class hex_binning(Operation):

min_count = param.Number(default=None)

orientation = param.ObjectSelector(default='pointy', objects=['flat', 'pointy'])
orientation = param.Selector(default='pointy', objects=['flat', 'pointy'])

def _process(self, element, key=None):
gridsize, aggregator, orientation = self.p.gridsize, self.p.aggregator, self.p.orientation
Expand Down Expand Up @@ -115,7 +115,7 @@ class HexTilesPlot(ColorbarPlot):
The display threshold before a bin is shown, by default bins with
a count of less than 1 are hidden.""")

orientation = param.ObjectSelector(default='pointy', objects=['flat', 'pointy'],
orientation = param.Selector(default='pointy', objects=['flat', 'pointy'],
doc="""
The orientation of hexagon bins. By default the pointy side is on top.""")

Expand Down
10 changes: 5 additions & 5 deletions holoviews/plotting/bokeh/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class BokehPlot(DimensionedPlot, CallbackPlot):

title_format = param.String(default=None, doc="Alias for title.")

toolbar = param.ObjectSelector(default='above',
toolbar = param.Selector(default='above',
objects=["above", "below",
"left", "right", None],
doc="""
Expand Down Expand Up @@ -367,7 +367,7 @@ class CompositePlot(BokehPlot):
to such a plot.
"""

sizing_mode = param.ObjectSelector(default=None, objects=[
sizing_mode = param.Selector(default=None, objects=[
'fixed', 'stretch_width', 'stretch_height', 'stretch_both',
'scale_width', 'scale_height', 'scale_both', None], doc="""

Expand Down Expand Up @@ -472,12 +472,12 @@ class GridPlot(CompositePlot, GenericCompositePlot):
show_legend = param.Boolean(default=False, doc="""
Adds a legend based on the entries of the middle-right plot""")

xaxis = param.ObjectSelector(default=True,
xaxis = param.Selector(default=True,
objects=['bottom', 'top', None, True, False], doc="""
Whether and where to display the xaxis, supported options are
'bottom', 'top' and None.""")

yaxis = param.ObjectSelector(default=True,
yaxis = param.Selector(default=True,
objects=['left', 'right', None, True, False], doc="""
Whether and where to display the yaxis, supported options are
'left', 'right' and None.""")
Expand Down Expand Up @@ -721,7 +721,7 @@ class LayoutPlot(CompositePlot, GenericLayoutPlot):
Whether to show the legend for a particular subplot by index. If True all legends
will be shown. If False no legends will be shown.""")

legend_position = param.ObjectSelector(objects=["top_right",
legend_position = param.Selector(objects=["top_right",
"top_left",
"bottom_left",
"bottom_right",
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ class ImageStackPlot(RasterPlot):

_plot_methods = dict(single='image_stack')

cnorm = param.ObjectSelector(default='eq_hist', objects=['linear', 'log', 'eq_hist'], doc="""
cnorm = param.Selector(default='eq_hist', objects=['linear', 'log', 'eq_hist'], doc="""
Color normalization to be applied during colormapping.""")

start_alpha = param.Integer(default=0, bounds=(0, 255))
Expand Down
Loading