
    -e,                       d Z ddlmZ ddlZ ej        e          ZddlmZ ddl	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 ddlmZ dd	lmZ dd
lmZ ddlmZ dZe
 G d de                      Ze
 G d de                      Z  G d de           Z! G d de           Z" G d de           Z# G d de           Z$ G d de$          Z% G d de$          Z& G d de$          Z' G d  d!e$          Z( G d" d#e"          Z) G d$ d%e"          Z* G d& d'e)          Z+ G d( d)e          Z,d*Z-d+Z.d,e.z  Z/d-e/z  Z0d.e0z  Z1d/e1z  Z2d0e1z  Z3 G d1 d2e#          Z4 G d3 d4e          Z5dS )5zH Models for computing good tick locations on different kinds
of plots.

    )annotationsN   )LatLon)abstract)
AutoEitherEnumFloatInstanceIntNullableOverrideRequiredSeq)error)MISSING_MERCATOR_DIMENSION)Model   )ScanningColorMapper)TickerBinnedTickerContinuousTickerFixedTickerAdaptiveTickerCompositeTickerSingleIntervalTicker
DaysTickerMonthsTickerYearsTickerBasicTicker	LogTickerMercatorTickerCategoricalTickerDatetimeTickerc                  $     e Zd ZdZd fdZ xZS )r   z) A base class for all ticker types.

    returnNonec                :     t                      j        |i | d S Nsuper__init__selfargskwargs	__class__s      4lib/python3.11/site-packages/bokeh/models/tickers.pyr,   zTicker.__init__M   %    $)&)))))    r&   r'   __name__
__module____qualname____doc__r,   __classcell__r1   s   @r2   r   r   F   sG         
* * * * * * * * * *r4   r   c                  X     e Zd ZdZd
 fdZ edd          Z edd	          Z xZS )r   z5 A base class for non-categorical ticker types.

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zContinuousTicker.__init__W   r3   r4      z`
    The number of minor tick positions to generate between
    adjacent major tick values.
    help   a>  
    A desired target number of major tick positions to generate across
    the plot range.

    .. note:
        This value is a suggestion, and ticker subclasses may ignore
        it entirely, or use it only as an ideal goal to approach as well
        as can be, in the context of a specific ticking strategy.
    r5   )	r7   r8   r9   r:   r,   r   num_minor_ticksdesired_num_ticksr;   r<   s   @r2   r   r   P   s~         
* * * * * * c! # 	 	 	O
 A % 	 	 	r4   r   c                  \     e Zd ZdZd fdZ eeg d          Z eeg d          Z xZ	S )	r   z Generate ticks at fixed, explicitly supplied locations.

    .. note::
        The ``desired_num_ticks`` property is ignored by this Ticker.

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zFixedTicker.__init__r   r3   r4   z'
    List of major tick locations.
    defaultrA   z'
    List of minor tick locations.
    r5   )
r7   r8   r9   r:   r,   r   r
   ticksminor_ticksr;   r<   s   @r2   r   r   i   s}         * * * * * * Cr ) 	 	 	E #eR / 	 	 	KKKKKr4   r   c                       e Zd ZdZd fdZ edd          Z eeg dd	
          Z edd          Z	 e
ed          Z xZS )r   a$   Generate "nice" round ticks at any magnitude.

    Creates ticks that are "base" multiples of a set of given
    mantissas. For example, with ``base=10`` and
    ``mantissas=[1, 2, 5]``, the ticker will generate the sequence::

        ..., 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, ...

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zAdaptiveTicker.__init__   r3   r4   g      $@z6
    The multiplier to use for scaling mantissas.
    r@   r   r   r?   z?
    The acceptable list numbers to generate multiples of.
    rG   g        zE
    The smallest allowable interval between two adjacent ticks.
    z
    The largest allowable interval between two adjacent ticks.

    .. note::
        To specify an unbounded interval, set to ``None``.
    r5   )r7   r8   r9   r:   r,   r
   baser   	mantissasmin_intervalr   max_intervalr;   r<   s   @r2   r   r   }   s         * * * * * * 5  	 	 	D E999 4 	 	 	I 5 $ 	 	 	L 8E ) 	 	 	LLLLLr4   r   c                  R     e Zd ZdZd fdZ e ee          g d          Z xZ	S )r   z Combine different tickers at different scales.

    Uses the ``min_interval`` and ``max_interval`` interval attributes
    of the tickers to select the appropriate ticker at different
    scales.

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zCompositeTicker.__init__   r3   r4   a  
    A list of Ticker objects to combine at different scales in order
    to generate tick values. The supplied tickers should be in order.
    Specifically, if S comes before T, then it should be the case that::

        S.get_max_interval() < T.get_min_interval()

    rG   r5   )
r7   r8   r9   r:   r,   r   r   r   tickersr;   r<   s   @r2   r   r      sf         * * * * * * c((6""B 6 	 	 	GGGGGr4   r   c                  $     e Zd ZdZd fdZ xZS )BaseSingleIntervalTickerz) Base class for single interval tickers. r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   z!BaseSingleIntervalTicker.__init__   r3   r4   r5   r6   r<   s   @r2   rV   rV      sC        33* * * * * * * * * *r4   rV   c                  >     e Zd ZdZd fdZ eed          Z xZS )r   zP Generate evenly spaced ticks at a fixed interval regardless of
    scale.

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zSingleIntervalTicker.__init__   r3   r4   z.
    The interval between adjacent ticks.
    r@   r5   )	r7   r8   r9   r:   r,   r   r
   intervalr;   r<   s   @r2   r   r      sZ         * * * * * * x % 	 	 	HHHHHr4   r   c                  X     e Zd ZdZd	 fdZ eeg d          Z ed          Z	 xZ
S )
r   zG Generate ticks spaced apart by specific, even multiples of days.

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zDaysTicker.__init__   r3   r4   z'
    The intervals of days to use.
    rG   r   rH   r5   )r7   r8   r9   r:   r,   r   r   daysr   rC   r;   r<   s   @r2   r   r      sp         
* * * * * * 3sB & 	 	 	D hq)))OOOOOr4   r   c                  @     e Zd ZdZd fdZ eeg d          Z xZS )r   zI Generate ticks spaced apart by specific, even multiples of months.

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zMonthsTicker.__init__   r3   r4   z)
    The intervals of months to use.
    rG   r5   )	r7   r8   r9   r:   r,   r   r   monthsr;   r<   s   @r2   r   r      s\         
* * * * * * Sb ( 	 	 	FFFFFr4   r   c                  $     e Zd ZdZd fdZ xZS )r   z9 Generate ticks spaced apart even numbers of years.

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zYearsTicker.__init__   r3   r4   r5   r6   r<   s   @r2   r   r      G         
* * * * * * * * * *r4   r   c                  $     e Zd ZdZd fdZ xZS )r    z| Generate ticks on a linear scale.

    .. note::
        This class may be renamed to ``LinearTicker`` in the future.

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zBasicTicker.__init__   r3   r4   r5   r6   r<   s   @r2   r    r       sG         * * * * * * * * * *r4   r    c                  @     e Zd ZdZd fdZ eddg          Z xZS )	r!   z% Generate ticks on a log scale.

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zLogTicker.__init__  r3   r4   r   r?   r]   r5   )r7   r8   r9   r:   r,   r   rO   r;   r<   s   @r2   r!   r!      sS         
* * * * * * !Q(((IIIIIr4   r!   c                  x     e Zd ZdZd fdZ e ee          d          Z e	e
          d             Z xZS )	r"   zK Generate nice lat/lon ticks form underlying WebMercator coordinates.

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zMercatorTicker.__init__  r3   r4   a  
    Specify whether to generate ticks for Latitude or Longitude.

    Projected coordinates are not separable, computing Latitude and Longitude
    tick locations from Web Mercator requires considering coordinates from
    both dimensions together. Use this property to specify which result should
    be returned.

    Typically, if the ticker is for an x-axis, then dimension should be
    ``"lon"`` and if the ticker is for a y-axis, then the dimension
    should be `"lat"``.

    In order to prevent hard to debug errors, there is no default value for
    dimension. Using an un-configured ``MercatorTicker`` will result in a
    validation error and a JavaScript console error.
    r@   c                2    | j         t          |           S d S r)   )	dimensionstr)r.   s    r2   _check_missing_dimensionz'MercatorTicker._check_missing_dimension!  s    >!t99 "!r4   r5   )r7   r8   r9   r:   r,   r   r	   r   rl   r   r   rn   r;   r<   s   @r2   r"   r"     s         
* * * * * * f - 	 	 	I" U%&&  '&    r4   r"   c                  $     e Zd ZdZd fdZ xZS )r#   z- Generate ticks for categorical ranges.

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zCategoricalTicker.__init__,  r3   r4   r5   r6   r<   s   @r2   r#   r#   &  rd   r4   r#   g      ?g     @@g      N@<         im  c                  V     e Zd ZdZd fdZ ed          Z ed           Z xZS )	r$   zA Generate nice ticks across different date and time scales.

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zDatetimeTicker.__init__=  r3   r4   r   r]   c                 (   t          g ddddt          z  d          t          g ddt          dt          z  d          t          g d	d
t          dt          z  d          t          t          t          dd                              t          t          t          ddd                              t          g d          t          ddg          t          t          t          ddd                              t          t          t          ddd                              t          t          t          ddd                              t          t          t          ddd                              t                      gS )NrM   
   r   i  )rO   rN   rP   rQ   rC   )r   r   r?   rw         rs   rq   rs   )r   r      rB         rr   r|   r       )r^         )r   r{   rx      rx   )ra   r   rz   rB   )
r   	ONE_MILLI
ONE_SECOND
ONE_MINUTEONE_HOURr   listranger   r    r4   r2   <lambda>zDatetimeTicker.<lambda>C  sx   iiY	
 	
 	
 	///#J	
 	
 	
 	)))!H	
 	
 	
 	U1b\\**+++U1b!__--...'''B   Dq"a11222Dq"a11222Dq"a11222Dq"a11222A!( r4   r5   )	r7   r8   r9   r:   r,   r   rC   rT   r;   r<   s   @r2   r$   r$   7  sq         
* * * * * * hq)))O h !  !  ! ! !GGGGGr4   r$   c                  \     e Zd ZdZd
 fdZ eed          Z ee	e
dd	          Z xZS )r   zU Ticker that aligns ticks exactly at bin boundaries of a scanning color mapper.

    r&   r'   c                :     t                      j        |i | d S r)   r*   r-   s      r2   r,   zBinnedTicker.__init__l  r3   r4   zF
    A scanning color mapper (e.g. ``EqHistColorMapper``) to use.
    r@   r{   zt
    The number of major tick positions to show or "auto" to use the
    number of bins provided by the mapper.
    rG   r5   )r7   r8   r9   r:   r,   r   r   mapperr   r   r   num_major_ticksr;   r<   s   @r2   r   r   f  s~         
* * * * * * X) 1 	 	 	F fS$ 9 	 	 	OOOOOr4   r   )6r:   
__future__r   logging	getLoggerr7   log
core.enumsr   core.has_propsr   core.propertiesr   r   r	   r
   r   r   r   r   r   r   core.validationr   core.validation.errorsr   modelr   mappersr   __all__r   r   r   r   r   rV   r   r   r   r   r    r!   r"   r#   r   r   r   r   ONE_DAY	ONE_MONTHONE_YEARr$   r   r   r4   r2   <module>r      s3    # " " " " " g!!        % % % % % %                        $ # # # # # ? ? ? ? ? ?       ( ( ( ( ( (, 
* * * * *U * * 
* 
	 	 	 	 	v 	 	 
	0	 	 	 	 	" 	 	 	( 	  	  	  	  	%  	  	  	D	 	 	 	 	& 	 	 	,* * * * */ * * *	 	 	 	 	3 	 	 	* * * * *) * * *	 	 	 	 	+ 	 	 	* * * * ** * * *
* 
* 
* 
* 
*. 
* 
* 
*	) 	) 	) 	) 	) 	) 	) 	)    [   >* * * * * * * * 	
J

?
x-L	=- - - - -_ - - -^	 	 	 	 	6 	 	 	 	 	r4   