U
    /eQr                     @  s0  d Z ddlmZ ddlZeeZddlZddlm	Z	m
Z
mZmZ ddlmZ ddlmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ dd	l%m&Z&m'Z' dd
l(m)Z) ddl*m+Z+m,Z, ddl-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z3m4Z4m5Z5m6Z6 ddl7m8Z8 ddl9m:Z: ddlm;Z;m<Z<m=Z= ddl>m?Z? ddl@mAZA ddlBmCZC ddlDmEZE ddlFmGZGmHZHmIZImJZJ ddlKmLZLmMZMmNZN ddlOmPZPmQZQmRZRmSZS ddlTmUZUmVZVmWZW ddlXmYZYmZZZm[Z[ e	rddl\m]Z] dZ^G dd deEZ_dd  Z`G d!d" d"eaZbd#ZcG d$d% d%ebZdd&d' ZedS )(z2 Models for representing top-level plot objects.

    )annotationsN)TYPE_CHECKINGAnyListoverload)Literal   )LocationOutputBackendPlace	PlaceTypeResetPolicy)AliasBoolDictEitherEnumFloatIncludeInstanceIntr   NullNullableOverrideReadonlyString)ScalarFillPropsScalarLineProps)find)errorwarning)BAD_EXTRA_RANGE_NAMEINCOMPATIBLE_SCALE_AND_RANGEREQUIRED_RANGEREQUIRED_SCALE)FIXED_HEIGHT_POLICYFIXED_SIZING_MODEFIXED_WIDTH_POLICYMISSING_RENDERERS)Model)	nice_join   )
AnnotationLegendTitle)Axis)Glyph)Grid)	LayoutDOM)DataRange1dFactorRangeRangeRange1d)GlyphRendererRendererTileRenderer)CategoricalScaleLinearScaleLogScaleScale)ColumnarDataSourceColumnDataSource
DataSource)	HoverToolToolToolbar)
TileSource)Plotc                   @  s  e Zd ZU dZdd Zdd Zdd Zdd	 Zed
d Z	edd Z
edd Zedd Zedd ZddddZedd Zedd Zedd Zeddd d!Zejdd"d#d!Zdd%d&d'd(d)d*Zd+d'd,d-d.Zed/d0d1d2d3d4Zed5d/d0d1d6d7d4Zdd9d:d0d1d;d<d4Zd=d0d>d?d@dAZeedBddCdDZeedBddEdFZeedBddGdHZe e!dBddIdJZ"ee#dBddKdLZ$e%e&dMdN dOdPZ'e%e&dQdN dRdPZ(e)dSdTdUdVdWZ*e%e+dXdN dYdPZ,e%e+dZdN d[dPZ-e.e/e%e&d\d]Z0e.e/e%e&d^d]Z1e.e/e%e+d_d]Z2e.e/e%e+d`d]Z3e4dadbdPZ5e6e7e%e8dcdN dddP9e/dedN Z:e;e<e=dfdgdPZ>e?e@dhdidjZAeBdkdlZCeDe%eEdmd]ZFe%eGdndN dodPZHe;e<e=dpdqdPZIe4dadrdPZJeDe%eEdsd]ZKeDe%eEdtd]ZLeDe%eEdud]ZMeDe%eEdvd]ZNeDe%eEdwd]ZOeBdxdlZPdyeQdz< eBdxdlZRdyeQd{< eSdzd|d]ZTdyeQd}< eSd{d~d]ZUdyeQd< e;eVdd]ZWe;eVdd]ZXeYeVdd]ZZeYeVdd]Z[eYeVdd]Z\eYeVdd]Z]e?e^dddjZ_eBddlZ`e?e^dddjZaeBddlZbe;eVdd]Zce;eVdd]Zde;eVdd]Zee;eVdd]Zfe;eVdddPZgeVddd]Zhe;eVdddPZieVddd]ZjeVddd]Zke<eldddPZme4dddPZneodddPZpe<eqdddPZreesdd Zteeudd Zveewdd Zxd8S )rE   zI Model representing a plot, containing glyphs, guides, annotations.

    c                 O  s   t ||}tt|  |S )au   Query this object and all of its references for objects that
        match the given selector.

        There are a few different ways to call the ``select`` method.
        The most general is to supply a JSON-like query dictionary as the
        single argument or as keyword arguments:

        Args:
            selector (JSON-like) : some sample text

        Keyword Arguments:
            kwargs : query dict key/values as keyword arguments

        Additionally, for compatibility with ``Model.select``, a selector
        dict may be passed as ``selector`` keyword argument, in which case
        the value of ``kwargs['selector']`` is used for the query.

        For convenience, queries on just names can be made by supplying
        the ``name`` string as the single parameter:

        Args:
            name (str) : the name to query on

        Also queries on just type can be made simply by supplying the
        ``Model`` subclass as the single parameter:

        Args:
            type (Model) : the type to query on

        Returns:
            seq[Model]

        Examples:

            .. code-block:: python

                # These three are equivalent
                p.select(selector={"type": HoverTool})
                p.select({"type": HoverTool})
                p.select(HoverTool)

                # These two are also equivalent
                p.select({"name": "mycircle"})
                p.select("mycircle")

                # Keyword arguments can be supplied in place of selector dict
                p.select({"name": "foo", "type": HoverTool})
                p.select(name="foo", type=HoverTool)

        )_select_helper_list_attr_splatr   Z
references)selfargskwargsselector rL   6/tmp/pip-unpacked-wheel-f5fndrjf/bokeh/models/plots.pyselectv   s    4
zPlot.selectc                 C  s   | | |kS )z Return whether this plot is in a given row of a GridPlot.

        Args:
            row (int) : index of the row to test
            gridplot (GridPlot) : the GridPlot to check

        Returns:
            bool

        )row)rH   rO   gridplotrL   rL   rM   rO      s    zPlot.rowc                 C  s   | | |kS )z Return whether this plot is in a given column of a GridPlot.

        Args:
            col (int) : index of the column to test
            gridplot (GridPlot) : the GridPlot to check

        Returns:
            bool

        )column)rH   colrP   rL   rL   rM   rQ      s    zPlot.columnc                 G  s6   g }|D ]}| t| |g  qdd |D }t|S )Nc                 S  s   g | ]}t |tr|qS rL   )
isinstancer/   .0objrL   rL   rM   
<listcomp>   s     
 zPlot._axis.<locals>.<listcomp>)extendgetattrrG   )rH   ZsidesobjssaxisrL   rL   rM   _axis   s
    z
Plot._axisc                 C  s   |  ddS )z[ Splattable list of :class:`~bokeh.models.axes.Axis` objects for the x dimension.

        abovebelowr]   rH   rL   rL   rM   xaxis   s    z
Plot.xaxisc                 C  s   |  ddS )z[ Splattable list of :class:`~bokeh.models.axes.Axis` objects for the y dimension.

        leftrightr`   ra   rL   rL   rM   yaxis   s    z
Plot.yaxisc                 C  s   t | j| j S )zG Splattable list of :class:`~bokeh.models.axes.Axis` objects.

        )rG   rb   re   ra   rL   rL   rM   r\      s    z	Plot.axisc                 C  s4   | j | j | j | j | j }dd |D }t|S )z/ Splattable list of |Legend| objects.

        c                 S  s   g | ]}t |tr|qS rL   )rS   r-   rT   rL   rL   rM   rW      s     
 zPlot.legend.<locals>.<listcomp>)r^   r_   rc   rd   center_legend_attr_splat)rH   ZpanelsZlegendsrL   rL   rM   legend   s    zPlot.legendc                 C  s   dd | j D }t|S )zM Splattable list of :class:`~bokeh.models.tools.HoverTool` objects.

        c                 S  s   g | ]}t |tr|qS rL   )rS   rA   rT   rL   rL   rM   rW      s     
 zPlot.hover.<locals>.<listcomp>)toolsrG   )rH   ZhoversrL   rL   rM   hover   s    z
Plot.hoverzLiteral[(0, 1)]	dimensionc                   s    fdd| j D }t|S )Nc                   s$   g | ]}t |tr|j kr|qS rL   )rS   r1   rl   rT   rk   rL   rM   rW      s     
 
 zPlot._grid.<locals>.<listcomp>)rf   rG   )rH   rl   gridrL   rk   rM   _grid   s    z
Plot._gridc                 C  s
   |  dS )z\ Splattable list of :class:`~bokeh.models.grids.Grid` objects for the x dimension.

        r   rn   ra   rL   rL   rM   xgrid   s    z
Plot.xgridc                 C  s
   |  dS )z\ Splattable list of :class:`~bokeh.models.grids.Grid` objects for the y dimension.

        r+   ro   ra   rL   rL   rM   ygrid  s    z
Plot.ygridc                 C  s   t | j| j S )zH Splattable list of :class:`~bokeh.models.grids.Grid` objects.

        )rG   rp   rq   ra   rL   rL   rM   rm     s    z	Plot.gridzTList[Tool])returnc                 C  s   | j jS Ntoolbarri   ra   rL   rL   rM   ri     s    z
Plot.tools)ri   c                 C  s   || j _d S rs   rt   )rH   ri   rL   rL   rM   ri     s    rf   r8   r   None)rV   placerr   c                 C  s4   |t kr td| dtt  t| || dS )aG   Adds an object to the plot in a specified place.

        Args:
            obj (Renderer) : the object to add to the Plot
            place (str, optional) : where to add the object (default: 'center')
                Valid places are: 'left', 'right', 'above', 'below', 'center'.

        Returns:
            None

        zInvalid place 'z%' specified. Valid place values are: N)r   
ValueErrorr*   rY   append)rH   rV   rw   rL   rL   rM   
add_layout  s
    zPlot.add_layoutrB   )ri   rr   c                 G  s.   |D ]$}t |tstd| jj| qdS )z Adds tools to the plot.

        Args:
            *tools (Tool) : the tools to add to the Plot

        Returns:
            None

        z2All arguments to add_tool must be Tool subclasses.N)rS   rB   rx   ru   ri   ry   )rH   ri   ZtoolrL   rL   rM   	add_tools*  s    

zPlot.add_toolsr0   r   r7   )glyphrJ   rr   c                 K  s   d S rs   rL   )rH   r|   rJ   rL   rL   rM   	add_glyph:  s    zPlot.add_glyphr>   )sourcer|   rJ   rr   c                 K  s   d S rs   rL   )rH   r~   r|   rJ   rL   rL   rM   r}   <  s    NzGlyph | ColumnarDataSourcezGlyph | None)source_or_glyphr|   rJ   rr   c                 K  sd   t |tr|}nt | }}t |ts.tdt |ts@tdtf ||d|}| j| |S )a   Adds a glyph to the plot with associated data sources and ranges.

        This function will take care of creating and configuring a Glyph object,
        and then add it to the plot's list of renderers.

        Args:
            source (DataSource) : a data source for the glyphs to all use
            glyph (Glyph) : the glyph to add to the Plot


        Keyword Arguments:
            Any additional keyword arguments are passed on as-is to the
            Glyph initializer.

        Returns:
            GlyphRenderer

        z<'source' argument to add_glyph() must be DataSource subclassz6'glyph' argument to add_glyph() must be Glyph subclass)Zdata_sourcer|   )	rS   r>   r?   r@   rx   r0   r7   	renderersry   )rH   r   r|   rJ   r~   grL   rL   rM   r}   ?  s    


rD   r9   )tile_sourcerJ   rr   c                 K  s"   t f d|i|}| j| |S )aU   Adds new ``TileRenderer`` into ``Plot.renderers``

        Args:
            tile_source (TileSource) : a tile source instance which contain tileset configuration

        Keyword Arguments:
            Additional keyword arguments are passed on as-is to the tile renderer

        Returns:
            TileRenderer : TileRenderer

        r   )r9   r   ry   )rH   r   rJ   Ztile_rendererrL   rL   rM   add_tilea  s    zPlot.add_tilez
str | Nonec                 C  s>   g }| j s|d | js$|d |r:d|d|   S d S )Nx_rangey_range,  [%s])r   ry   r   joinrH   missingrL   rL   rM   _check_required_ranger  s     
 
zPlot._check_required_rangec                 C  s>   g }| j s|d | js$|d |r:d|d|   S d S )Nx_scaley_scaler   r   )r   ry   r   r   r   rL   rL   rM   _check_required_scalez  s     
 
zPlot._check_required_scalec                 C  s  g }t | j }| jr$|| j t | j }| jrD|| j | jd k	r|D ]}t|t	t
frt| jttfs|d|| jf  n*t|trt| jts|d|| jf  t|t	t
frRt| jtrR|d|| jf  qR| jd k	r|D ]}t|t	t
fr0t| jttfs0|d|| jf  n.t|tr^t| jts^|d|| jf  t|t	t
frt| jtr|d|| jf  q|rd|d|   S d S )Nz&incompatibility on x-dimension: %s, %sz%incompatibility on x-dimension: %s/%sz%incompatibility on y-dimension: %s/%sz&incompatibility on y-dimension: %s, %sr   r   )listextra_x_rangesvaluesr   ry   extra_y_rangesr   r   rS   r3   r6   r;   r<   r4   r:   r   r   )rH   ZincompatibleZx_rangesZy_rangesrngrL   rL   rM   "_check_compatible_scale_and_ranges  s2      
"z'Plot._check_compatible_scale_and_rangesc                 C  s2   t | jdkr.t dd | jD dkr.t| S d S )Nr   c                 S  s   g | ]}t |tr|qS rL   )rS   r,   rU   xrL   rL   rM   rW     s     
 z1Plot._check_missing_renderers.<locals>.<listcomp>)lenr   rf   strra   rL   rL   rM   _check_missing_renderers  s    &zPlot._check_missing_renderersc                   s   d}fdddD }t tdg D ]T}t|D ]D d fdd| D }|r2||r`dnd| d	  d
 7 }q2q$|r|S d S )N c              	     s,   i | ]$}| d dht  d| dqS )_namedefaultZextra_r[   rY   )rU   r\   ra   rL   rM   
<dictcomp>  s    z4Plot._check_bad_extra_range_name.<locals>.<dictcomp>)r   r   r   r   c                 3  s8   | ]0\}}t  |d |kr| dt  | dV  qdS )r   z=''Nr   )rU   r\   keys)refrL   rM   	<genexpr>  s   z3Plot._check_bad_extra_range_name.<locals>.<genexpr>z [])r   r   rY   r   items)rH   msgZvalidrw   badrL   )r   rH   rM   _check_bad_extra_range_name  s    
$z Plot._check_bad_extra_range_namec                   C  s   t  S rs   r3   rL   rL   rL   rM   <lambda>      zPlot.<lambda>zK
    The (default) data range of the horizontal dimension of the plot.
    )r   helpc                   C  s   t  S rs   r   rL   rL   rL   rM   r     r   zI
    The (default) data range of the vertical dimension of the plot.
    z1Literal[('auto', 'linear', 'log', 'categorical')]r=   )scalerr   c                 C  s<   |dkrt  S |dkrt S |dkr*t S td| d S )N)autoZlinearlogZcategoricalzUnknown mapper_type: )r;   r<   r:   rx   )clsr   rL   rL   rM   _scale  s    zPlot._scalec                   C  s   t  S rs   r;   rL   rL   rL   rM   r     r   zr
    What kind of scale to use to convert x-coordinates in data space
    into x-coordinates in screen space.
    c                   C  s   t  S rs   r   rL   rL   rL   rM   r     r   zr
    What kind of scale to use to convert y-coordinates in data space
    into y-coordinates in screen space.
    z~
    Additional named ranges to make available for mapping x-coordinates.

    This is useful for adding additional axes.
    )r   z~
    Additional named ranges to make available for mapping y-coordinates.

    This is useful for adding additional axes.
    z
    Additional named scales to make available for mapping x-coordinates.

    This is useful for adding additional axes.

    .. note:: This feature is experimental and may change in the short term.
    z
    Additional named scales to make available for mapping y-coordinates.

    This is useful for adding additional axes.

    .. note:: This feature is experimental and may change in the short term.
    Tz3
    Whether to use HiDPI mode when available.
    c                   C  s
   t ddS )Nr   textr.   rL   rL   rL   rM   r     r   zK
    A title for the plot. Can be a text string or a Title annotation.
    c                 C  s
   t | dS )Nr   r   r   rL   rL   rM   r     r   r^   z`
    Where the title will be located. Titles on the left or right side
    will be rotated.
    outlinez1
    The {prop} for the plot border outline.
    )prefixr   z#e5e5e5)r   a  
    A list of all renderers for this plot, including guides and annotations
    in addition to glyphs.

    This property can be manipulated by hand, but the ``add_glyph`` and
    ``add_layout`` methods are recommended to help make sure all necessary
    setup is performed.
    c                   C  s   t  S rs   )rC   rL   rL   rL   rM   r     r   z
    The toolbar associated with this plot which holds all the tools. It is
    automatically created with the plot if necessary.
    rd   zi
    Where the toolbar will be located. If set to None, no toolbar
    will be attached to the plot.
    z
    Stick the toolbar to the edge of the plot. Default: True. If False,
    the toolbar will be outside of the axes, titles etc.
    zI
    A list of renderers to occupy the area to the left of the plot.
    zJ
    A list of renderers to occupy the area to the right of the plot.
    zC
    A list of renderers to occupy the area above of the plot.
    zC
    A list of renderers to occupy the area below of the plot.
    zL
    A list of renderers to occupy the center area (frame) of the plot.
    iX  z
int | NonewidthheightzU
    The outer width of a plot, including any axes, titles, border padding, etc.
    
plot_widthzV
    The outer height of a plot, including any axes, titles, border padding, etc.
    plot_heightzv
    The width of a plot frame or the inner width of a plot, excluding any
    axes, titles, border padding, etc.
    zx
    The height of a plot frame or the inner height of a plot, excluding any
    axes, titles, border padding, etc.
    al  
    This is the exact width of the plotting canvas, i.e. the width of
    the actual plot, without toolbars etc. Note this is computed in a
    web browser, so this property will work only in backends capable of
    bidirectional communication (server, notebook).

    .. note::
        This is an experimental feature and the API may change in near future.

    an  
    This is the exact height of the plotting canvas, i.e. the height of
    the actual plot, without toolbars etc. Note this is computed in a
    web browser, so this property will work only in backends capable of
    bidirectional communication (server, notebook).

    .. note::
        This is an experimental feature and the API may change in near future.

    aa  
    This is the exact width of the layout, i.e. the height of
    the actual plot, with toolbars etc. Note this is computed in a
    web browser, so this property will work only in backends capable of
    bidirectional communication (server, notebook).

    .. note::
        This is an experimental feature and the API may change in near future.

    ab  
    This is the exact height of the layout, i.e. the height of
    the actual plot, with toolbars etc. Note this is computed in a
    web browser, so this property will work only in backends capable of
    bidirectional communication (server, notebook).

    .. note::
        This is an experimental feature and the API may change in near future.

    Z
backgroundz3
    The {prop} for the plot background style.
    z#ffffffZborderz/
    The {prop} for the plot border style.
    z
    Minimum size in pixels of the padding region above the top of the
    central plot region.

    .. note::
        This is a *minimum*. The padding region may expand as needed to
        accommodate titles or axes, etc.

    z
    Minimum size in pixels of the padding region below the bottom of
    the central plot region.

    .. note::
        This is a *minimum*. The padding region may expand as needed to
        accommodate titles or axes, etc.

    z
    Minimum size in pixels of the padding region to the left of
    the central plot region.

    .. note::
        This is a *minimum*. The padding region may expand as needed to
        accommodate titles or axes, etc.

    z
    Minimum size in pixels of the padding region to the right of
    the central plot region.

    .. note::
        This is a *minimum*. The padding region may expand as needed to
        accommodate titles or axes, etc.

       z
    A convenience property to set all all the ``min_border_X`` properties
    to the same value. If an individual border property is explicitly set,
    it will override ``min_border``.
    
   zL
    Decimation factor to use when applying level-of-detail decimation.
    i  z
    A number of data points, above which level-of-detail downsampling may
    be performed by glyph renderers. Set to ``None`` to disable any
    level-of-detail downsampling.
    i,  zo
    Interval (in ms) during which an interactive tool event will enable
    level-of-detail downsampling.
    i  a  
    Timeout (in ms) for checking whether interactive tool events are still
    occurring. Once level-of-detail mode is enabled, a check is made every
    ``lod_timeout`` ms. If no interactive tool events have happened,
    level-of-detail mode is disabled.
    Zcanvasz
    Specify the output backend for the plot area. Default is HTML5 Canvas.

    .. note::
        When set to ``webgl``, glyphs without a WebGL rendering implementation
        will fall back to rendering onto 2D canvas.
    Fa;  
    Specify the aspect ratio behavior of the plot. Aspect ratio is defined as
    the ratio of width over height. This property controls whether Bokeh should
    attempt to match the (width/height) of *data space* to the (width/height)
    in pixels of *screen space*.

    Default is ``False`` which indicates that the *data* aspect ratio and the
    *screen* aspect ratio vary independently. ``True`` indicates that the plot
    aspect ratio of the axes will match the aspect ratio of the pixel extent
    the axes. The end result is that a 1x1 area in data space is a square in
    pixels, and conversely that a 1x1 pixel is a square in data units.

    .. note::
        This setting only takes effect when there are two dataranges. This
        setting only sets the initial plot draw and subsequent resets. It is
        possible for tools (single axis zoom, unconstrained box zoom) to
        change the aspect ratio.

    .. warning::
        This setting is incompatible with linking dataranges across multiple
        plots. Doing so may result in undefined behavior.
    r+   a  
    A value to be given for increased aspect ratio control. This value is added
    multiplicatively to the calculated value required for ``match_aspect``.
    ``aspect_scale`` is defined as the ratio of width over height of the figure.

    For example, a plot with ``aspect_scale`` value of 2 will result in a
    square in *data units* to be drawn on the screen as a rectangle with a
    pixel width twice as long as its pixel height.

    .. note::
        This setting only takes effect if ``match_aspect`` is set to ``True``.
    standardaq  
    How a plot should respond to being reset. By deafult, the standard actions
    are to clear any tool state history, return plot ranges to their original
    values, undo all selections, and emit a ``Reset`` event. If customization
    is desired, this property may be set to ``"event_only"``, which will
    suppress all of the actions except the Reset event.
    c                 C  s   d S rs   rL   ra   rL   rL   rM   _check_fixed_sizing_mode  s    zPlot._check_fixed_sizing_modec                 C  s   d S rs   rL   ra   rL   rL   rM   _check_fixed_width_policy  s    zPlot._check_fixed_width_policyc                 C  s   d S rs   rL   ra   rL   rL   rM   _check_fixed_height_policy   s    zPlot._check_fixed_height_policy)rf   )N)y__name__
__module____qualname____doc__rN   rO   rQ   r]   propertyrb   re   r\   rh   rj   rn   rp   rq   rm   ri   setterrz   r{   r   r}   r   r   r#   r   r$   r   r"   r   r    r(   r   r!   r   r   r5   r   r   classmethodr   r=   r   r   r   r   r   r   Zextra_x_scalesZextra_y_scalesr   Zhidpir   r   r.   Zacceptstitler   r   r	   Ztitle_locationr   r   Zoutline_propsr   Zoutline_line_colorr   r8   r   rC   ru   Ztoolbar_locationZtoolbar_stickyrc   rd   r^   r_   rf   r   __annotations__r   r   r   r   r   Zframe_widthZframe_heightr   Zinner_widthZinner_heightZouter_widthZouter_heightr   Zbackground_propsZbackground_fill_colorZborder_propsZborder_fill_colorZmin_border_topZmin_border_bottomZmin_border_leftZmin_border_rightZ
min_borderZ
lod_factorZlod_thresholdZlod_intervalZlod_timeoutr
   Zoutput_backendZmatch_aspectr   Zaspect_scaler   Zreset_policyr&   r   r'   r   r%   r   rL   rL   rL   rM   rE   q   s   
9







"
 
	





	

rE   c                 C  s$   | |kr ||kr t d| |f d S )Nz-Conflicting properties set on plot: %r and %r)rx   )Za1Za2rJ   rL   rL   rM   _check_conflicting_kwargs  s    r   c                   @  s$   e Zd Zdd Zdd Zdd ZdS )rG   c                 C  s   | D ]}t ||| qd S rs   )setattr)rH   attrvaluer   rL   rL   rM   __setattr__  s    z_list_attr_splat.__setattr__c                   s    t tkrt|  S t| dkr0td  t| dkrJt| d  S zt fdd| D W S  tk
r   td  f Y nX d S )Nr   z;Trying to access %r attribute on an empty 'splattable' listr+   c                   s   g | ]}t | qS rL   r   r   r   rL   rM   rW     s     z5_list_attr_splat.__getattribute__.<locals>.<listcomp>zYTrying to access %r attribute on a 'splattable' list, but list items have no %r attribute)dirr   __getattribute__r   AttributeErrorrY   rG   	Exception)rH   r   rL   r   rM   r     s    z!_list_attr_splat.__getattribute__c                 C  s.   t dd | D dkr"t| d S t| S d S )Nc                 S  s   h | ]}t |qS rL   )typer   rL   rL   rM   	<setcomp>!  s     z+_list_attr_splat.__dir__.<locals>.<setcomp>r+   r   )r   r   ra   rL   rL   rM   __dir__   s    z_list_attr_splat.__dir__N)r   r   r   r   r   r   rL   rL   rL   rM   rG     s   rG   z
You are attempting to set `plot.legend.%s` on a plot that has zero legends added, this will have no effect.

Before legend properties can be set, you must add a Legend explicitly, or call a glyph method with a legend parameter set.
c                      s   e Zd Z fddZ  ZS )rg   c                   s$   t | stt|  t ||S rs   )r   warningswarn_LEGEND_EMPTY_WARNINGsuperr   )rH   r   r   	__class__rL   rM   r   -  s    z_legend_attr_splat.__setattr__)r   r   r   r   __classcell__rL   rL   r   rM   rg   ,  s   rg   c                 C  s   t | dkrtdt | dkr4t |dkr4tdt | dkrTt |dkrTtd| r| d }t|trp|}qt|trt|d}qt|trt|trd|i}qtdn,d	|krt |dkr|d	 }qtd
n|}|S )zA Allow flexible selector syntax.

    Returns:
        dict

    r+   z/select accepts at most ONE positional argument.r   zMselect accepts EITHER a positional argument, OR keyword arguments (not both).zCselect requires EITHER a positional argument, OR keyword arguments.)namer   z5selector must be a dictionary, string or plot object.rK   zJwhen passing 'selector' keyword arg, not other keyword args may be present)r   	TypeErrorrS   dictr   r   
issubclassr)   )rI   rJ   argrK   rL   rL   rM   rF   2  s*    





rF   )fr   
__future__r   logging	getLoggerr   r   r   typingr   r   r   ZTListr   Ztyping_extensionsr   Z
core.enumsr	   r
   r   r   r   Zcore.propertiesr   r   r   r   r   r   r   r   r   r   r   r   r   r   Zcore.property_mixinsr   r   Z
core.queryr   Zcore.validationr   r    Zcore.validation.errorsr!   r"   r#   r$   Zcore.validation.warningsr%   r&   r'   r(   modelr)   Zutil.stringr*   r,   r-   r.   Zaxesr/   Zglyphsr0   Zgridsr1   Zlayoutsr2   rangesr3   r4   r5   r6   r   r7   r8   r9   Zscalesr:   r;   r<   r=   sourcesr>   r?   r@   ri   rA   rB   rC   ZtilesrD   __all__rE   r   r   rG   r   rg   rF   rL   rL   rL   rM   <module>   sN   
D      