
    ^h:                        S r SSKJrJrJrJrJrJrJrJ	r	J
r
  SSKJr  SSKJrJr  SSKJr  SSKJrJr  SSKJr  SS	KJrJr   " S
 S\\\5      r " S S\5      r " S S\5      r\ " S S\5      5       r\ " S S\5      5       r\ " S S\5      5       r\ " S S\5      5       r \ " S S\5      5       r! " S S\5      r" " S S\"5      r#\ " S S\#5      5       r$g )!z<Float class.

Represents an unbounded float using a widget.
    )	InstanceUnicodeCFloatBoolCaselessStrEnumTuple
TraitErrorvalidatedefault   )DescriptionWidget)InstanceDictNumberFormat)ValueWidget)registerwidget_serialization)
CoreWidget)ProgressStyleSliderStylec                   T   ^  \ rS rSr\" SSS9R                  SS9rS	U 4S jjrSrU =r	$ )
_Float           Float valuehelpTsyncc                 4   > Ub  XS'   [         TU ]  " S0 UD6  g )Nvalue )super__init__)selfr    kwargs	__class__s      Y/home/james-whalen/.local/lib/python3.13/site-packages/ipywidgets/widgets/widget_float.pyr#   _Float.__init__   s     #7O"6"    r!   N)
__name__
__module____qualname____firstlineno__r   tagr    r#   __static_attributes____classcell__r&   s   @r'   r   r      s'    3]+//T/:E# #r)   r   c                       \ rS rSr\" SSS9R                  SS9r\" SSS9R                  SS9r\" S	5      S
 5       r	\" S5      S 5       r
\" S5      S 5       rSrg)_BoundedFloat         Y@	Max valuer   Tr   r   	Min valuer    c                     US   nU R                   U:  d  U R                  U:  a)  [        [        X R                   5      U R                  5      nU$ zCap and floor valuer    )minmaxr$   proposalr    s      r'   _validate_value_BoundedFloat._validate_value!   sC     !88etxx%/E88,dhh7Er)   r;   c                 n    US   nX R                   :  a  [        S5      eX R                  :  a  X l        U$ )Enforce min <= value <= maxr    Setting min > max)r<   r	   r    r$   r>   r;   s      r'   _validate_min_BoundedFloat._validate_min)   7     w>011J
r)   r<   c                 n    US   nX R                   :  a  [        S5      eX R                  :  a  X l        U$ )rB   r    setting max < min)r;   r	   r    r$   r>   r<   s      r'   _validate_max_BoundedFloat._validate_max3   rG   r)   r    N)r+   r,   r-   r.   r   r/   r<   r;   r
   r?   rE   rK   r0   r!   r)   r'   r4   r4      s}    
[
)
-
-4
-
8C
;
'
+
+
+
6Cg  e_  e_ r)   r4   c                      \ rS rSr\" SSS9R                  SS9r\" SSS9R                  SS9r\" S	S
S9R                  SS9r\" SSS9R                  SS9r	\
" S5      S 5       r\
" S5      S 5       r\
" S5      S 5       rSrg)_BoundedLogFloat=   g      @zMax value for the exponentr   Tr   r   zMin value for the exponent      $@zBase of value      ?r   r    c                 
   US   nU R                   U R                  -  U:  d  U R                   U R                  -  U:  aC  [        [        X R                   U R                  -  5      U R                   U R                  -  5      nU$ r:   )baser;   r<   r=   s      r'   r?    _BoundedLogFloat._validate_valueC   sg     !99 5(DII,AE,IE99#9:DII$((<RSEr)   r;   c                     US   nX R                   :  a  [        S5      eU R                  U-  U R                  :  a  U R                  U-  U l        U$ )+Enforce base ** min <= value <= base ** maxr    rC   )r<   r	   rT   r    rD   s      r'   rE   _BoundedLogFloat._validate_minK   M     w>01199djj(c)DJ
r)   r<   c                     US   nX R                   :  a  [        S5      eU R                  U-  U R                  :  a  U R                  U-  U l        U$ )rW   r    rI   )r;   r	   rT   r    rJ   s      r'   rK   _BoundedLogFloat._validate_maxU   rY   r)   rM   N)r+   r,   r-   r.   r   r/   r<   r;   rT   r    r
   r?   rE   rK   r0   r!   r)   r'   rO   rO   =   s    
7
8
<
<$
<
GC
7
8
<
<$
<
GC$_-11t1<D3]+//T/:Eg  e_  e_ r)   rO   c                       \ rS rSrSr\" S5      R                  SS9r\" S5      R                  SS9r\	" SSS	9R                  SS9r
\	" SS
S	9R                  SS9r\" SSSS9R                  SS9rSrg)	FloatText`   aA  Displays a float value within a textbox. For a textbox in
which the value must be within a specific range, use BoundedFloatText.

Parameters
----------
value : float
    value displayed
step : float
    step of the increment (if None, any step is allowed)
description : str
    description displayed next to the text box
FloatTextViewTr   FloatTextModelFEnable or disable user changesr   lUpdate the value as the user types. If False, update on submission, e.g., pressing Enter or navigating away.N#Minimum step to increment the value
allow_noner   r!   r+   r,   r-   r.   __doc__r   r/   
_view_name_model_namer   disabledcontinuous_updater   stepr0   r!   r)   r'   r]   r]   `   s     )--4-8J*+//T/:KE @AEE4EPHU  *X  Y  ]  ]  cg  ]  h$4.STXX^bXcDr)   r]   c                       \ rS rSrSr\" S5      R                  SS9r\" S5      R                  SS9r\	" SSS	9R                  SS9r
\	" SS
S	9R                  SS9r\" SSSS9R                  SS9rSrg)BoundedFloatTextu   a  Displays a float value within a textbox. Value must be within the range specified.

For a textbox in which the value doesn't need to be within a specific range, use FloatText.

Parameters
----------
value : float
    value displayed
min : float
    minimal value of the range of possible values displayed
max : float
    maximal value of the range of possible values displayed
step : float
    step of the increment (if None, any step is allowed)
description : str
    description displayed next to the textbox
r_   Tr   BoundedFloatTextModelFra   r   rb   Nrc   rd   r!   rf   r!   r)   r'   rn   rn   u   s    " )--4-8J1266D6AKE @AEE4EPHU  *X  Y  ]  ]  cg  ]  h$4.STXX^bXcDr)   rn   c                      \ rS rSrSr\" S5      R                  SS9r\" S5      R                  SS9r\	" SSSS	9R                  SS9r
\" S
S/S
SS9R                  SS9r\" SSS9R                  SS9r\" SSS9R                  SS9r\" SSS9R                  SS9r\" SSS9R                  SS9r\" \5      R                  " SSS0\D6r\" / SQSSS9R                  SS9rSrg)FloatSlider   a  Slider/trackbar of floating values with the specified range.

Parameters
----------
value : float
    position of the slider
min : float
    minimal position of the slider
max : float
    maximal position of the slider
step : float
    step of the trackbar
description : str
    name of the slider
orientation : {'horizontal', 'vertical'}
    default is 'horizontal', orientation of the slider
readout : {True, False}
    default is True, display the current value of the slider next to it
behavior : str
    slider handle and connector dragging behavior. Default is 'drag-tap'.
readout_format : str
    default is '.2f', specifier for the format function used to represent
    slider value for human consumption, modeled after Python 3's format
    specification mini-language (PEP 3101).
FloatSliderViewTr   FloatSliderModel皙?rc   rd   
horizontalverticalVertical or horizontal.valuesdefault_valuer   3Display the current value of the slider next to it.r   .2fFormat for the readoutAUpdate the value of the widget as the user is holding the slider.Fra   r   drag-tapz	drag-snaptapdragsnapr   Slider dragging behavior.r!   Nr+   r,   r-   r.   rg   r   r/   rh   ri   r   rl   r   orientationr   readoutr   readout_formatrk   rj   r   r   r   stylebehaviorr0   r!   r)   r'   rr   rr      s1   2 *+//T/:J,-11t1<K#$-RSWW]aWbD!,
)C")BDDGCTCN 4STXX^bXcG!,..1ctcn T(klppvzp{E @AEE4EPH%))LtL7KLE&V 'BDDGCTCN r)   rr   c                      \ rS rSrSr\" S5      R                  SS9r\" S5      R                  SS9r\	" SSSS	9R                  SS9r
\" S
S/S
SS9R                  SS9r\" SSS9R                  SS9r\" SSS9R                  SS9r\" SSS9R                  SS9r\" SSS9R                  SS9r\	" SSS9R                  SS9r\" \5      R                  " SSS0\D6r\" / SQSSS9R                  SS9rSrg)FloatLogSlider   a  Slider/trackbar of logarithmic floating values with the specified range.

Parameters
----------
value : float
    position of the slider
base : float
    base of the logarithmic scale. Default is 10
min : float
    minimal position of the slider in log scale, i.e., actual minimum is base ** min
max : float
    maximal position of the slider in log scale, i.e., actual maximum is base ** max
step : float
    step of the trackbar, denotes steps for the exponent, not the actual value
description : str
    name of the slider
orientation : {'horizontal', 'vertical'}
    default is 'horizontal', orientation of the slider
readout : {True, False}
    default is True, display the current value of the slider next to it
behavior : str
    slider handle and connector dragging behavior. Default is 'drag-tap'.
readout_format : str
    default is '.3g', specifier for the format function used to represent
    slider value for human consumption, modeled after Python 3's format
    specification mini-language (PEP 3101).
FloatLogSliderViewTr   FloatLogSliderModelrv   z3Minimum step in the exponent to increment the valuerd   rw   rx   ry   rz   r}   r   z.3gr   r   Fra   rQ   zBase for the logarithmr   r   r   r   r!   N)r+   r,   r-   r.   rg   r   r/   rh   ri   r   rl   r   r   r   r   r   r   rk   rj   rT   r   r   r   r   r   r0   r!   r)   r'   r   r      sL   6 -.222=J/044$4?K#$-bcggmqgrD!,
)C")BDDGCTCN 4STXX^bXcG!,..1ctcn T(klppvzp{E @AEE4EPH#4599t9DD%))LtL7KLE&V 'BDDGCTCN r)   r   c                       \ rS rSrSr\" S5      R                  SS9r\" S5      R                  SS9r\	" SS/SS	S
9R                  SS9r
\	" / SQSSSS9R                  SS9r\" \5      R                  " SSS0\D6rSrg)FloatProgress   a#  Displays a progress bar.

Parameters
-----------
value : float
    position within the range of the progress bar
min : float
    minimal position of the slider
max : float
    maximal position of the slider
description : str
    name of the progress bar
orientation : {'horizontal', 'vertical'}
    default is 'horizontal', orientation of the progress bar
bar_style: {'success', 'info', 'warning', 'danger', ''}
    color of the progress bar, default is '' (blue)
    colors are: 'success'-green, 'info'-light blue, 'warning'-orange, 'danger'-red
ProgressViewTr   FloatProgressModelrw   rx   ry   rz   )successinfowarningdanger r   z.Use a predefined styling for the progress bar.)r{   r|   re   r   r   r!   N)r+   r,   r-   r.   rg   r   r/   rh   ri   r   r   	bar_styler   r   r   r   r0   r!   r)   r'   r   r      s    $ (,,$,7J./333>K!,
)C")BDDGCTCN   ;T=? @Css~ 
 '++NN9MNEr)   r   c                       \ rS rSr\" \" 5       \" 5       SSS9R                  SS9r\S 5       r	\	R                  S 5       r	\S	 5       r\R                  S
 5       r\" S5      S 5       rSrg)_FloatRangei  )r   rR   zTuple of (lower, upper) bounds)r|   r   Tr   c                      U R                   S   $ Nr   rM   r$   s    r'   lower_FloatRange.lower
      zz!}r)   c                 .    XR                   S   4U l         g Nr   rM   )r$   r   s     r'   r   r     s    ZZ]+
r)   c                      U R                   S   $ r   rM   r   s    r'   upper_FloatRange.upper  r   r)   c                 0    U R                   S   U4U l         g r   rM   )r$   r   s     r'   r   r     s    jjmU+
r)   r    c                 6    US   u  p#X2:  a  [        S5      eX#4$ )Nr    zsetting lower > upper)r	   )r$   r>   r   r   s       r'   r?   _FloatRange._validate_value  s'    (=455|r)   rM   N)r+   r,   r-   r.   r   r   r/   r    propertyr   setterr   r
   r?   r0   r!   r)   r'   r   r     s    &(FHJ799<$ 
   \\, ,   \\, , g r)   r   c                      ^  \ rS rSr\" SSS9R                  SS9r\" SSS9R                  SS9r\" S	S
S9R                  SS9rU 4S jr	\
" SS5      S 5       r\
" S5      U 4S j5       rSrU =r$ )_BoundedFloatRangei"  rR   z<Minimum step that the value can take (ignored by some views)r   Tr   r6   r7   r   r8   c           	      p  > UR                  SS5      UR                  SS5      pCUR                  SS 5      c  SU-  SU-  -   SU-  SU-  -   4US'   O*[        US   [        5      (       d   [        US   5      US'   [        TU ]  " U0 UD6  g !   [        SR	                  [        US   5      5      5      e= f)	Nr;   r   r<   r6   r    g      ?g      ?z_A 'range' must be able to be cast to a tuple. The input of type {} could not be cast to a tuple)get
isinstancetuple	TypeErrorformattyper"   r#   )r$   argsr%   r;   r<   r&   s        r'   r#   _BoundedFloatRange.__init__'  s    ::eS)6::eU+CS::gt$,#czD3J6#czD3J68F7OF7OU33"'w"8w 	$)&)77=vd6'?>S7T s   +B (B5r;   r<   c                    US   nUS   nUR                   S:X  a  X0R                  :  a  [        S5      eUR                   S:X  a  X0R                  :  a  [        S5      eUR                   S:X  a5  [        X0R                  S   5      [        X0R                  S   5      4U l        UR                   S:X  a5  [        X0R                  S   5      [        X0R                  S   5      4U l        U$ )	Ntraitr    r;   zsetting min > maxr<   rI   r   r   )namer<   r	   r;   r    )r$   r>   r   news       r'   _validate_bounds#_BoundedFloatRange._validate_bounds6  s    !w::3>011::3>011::c::a=13sJJqM3JKDJ::c::a=13sJJqM3JKDJ
r)   r    c                    > [         TU ]  U5      u  p#[        X R                  5      [        X0R                  5      p2[        X R                  5      [        X0R                  5      p2X#4$ r*   )r"   r?   r;   r<   )r$   r>   r   r   r&   s       r'   r?   "_BoundedFloatRange._validate_valueD  sN    w.x85((+S-Au5((+S-Au|r)   rM   )r+   r,   r-   r.   r   r/   rl   r<   r;   r#   r
   r   r?   r0   r1   r2   s   @r'   r   r   "  s    #Z[__ei_jD
[
)
-
-4
-
8C
;
'
+
+
+
6C* eU  g r)   r   c                      \ rS rSrSr\" S5      R                  SS9r\" S5      R                  SS9r\	" SSSS	9R                  SS9r
\" S
S/S
SS9R                  SS9r\" SSS9R                  SS9r\" SSS9R                  SS9r\" SSS9R                  SS9r\" SSS9R                  SS9r\" \5      R                  " SSS0\D6r\" / SQSSS9R                  SS9rSrg)FloatRangeSlideriL  a"  Slider/trackbar that represents a pair of floats bounded by minimum and maximum value.

Parameters
----------
value : float tuple
    range of the slider displayed
min : float
    minimal position of the slider
max : float
    maximal position of the slider
step : float
    step of the trackbar
description : str
    name of the slider
orientation : {'horizontal', 'vertical'}
    default is 'horizontal'
readout : {True, False}
    default is True, display the current value of the slider next to it
behavior : str
    slider handle and connector dragging behavior. Default is 'drag-tap'.
readout_format : str
    default is '.2f', specifier for the format function used to represent
    slider value for human consumption, modeled after Python 3's format
    specification mini-language (PEP 3101).
FloatRangeSliderViewTr   FloatRangeSliderModelrv   rc   rd   rw   rx   ry   rz   r}   r   r~   r   zAUpdate the value of the widget as the user is sliding the slider.Fra   r   r   r   r   r!   Nr   r!   r)   r'   r   r   L  s1   2 /044$4?J1266D6AK#$-RSWW]aWbD!,
)C")BDDGCTCN 4STXX^bXcG!,..1ctcn T(klppvzp{E @AEE4EPH%))LtL7KLE&V 'BDDGCTCN r)   r   N)%rg   	traitletsr   r   r   r   r   r   r	   r
   r   widget_descriptionr   trait_typesr   r   valuewidgetr   widgetr   r   widget_corer   
widget_intr   r   r   r4   rO   r]   rn   rr   r   r   r   r   r   r!   r)   r'   <module>r      s*     2 3 $ 2 # 2#Z #F @ v  F 
d d 
d( 
d} d 
d0 
&S- &S 
&SR 
)S% )S 
)SX 
OM O 
O@& 8' 'T 
&S) &S 
&Sr)   