
    Fg                        S r SSKJr  SSKJr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  \(       a  SS	KJr  \
" 5        " S
 S\5      5       rg)zgr.Number() component.    )annotations)CallableSequence)TYPE_CHECKINGAny)document)	ComponentFormComponent)Events)Error)Timerc                  L  ^  \ rS rSrSr\R                  \R                  \R                  \R                  /r
 SSSSSSSSSSSSSSSSSSSS.                                     SU 4S jjjjr\SS	 j5       rSS
 jrSS jrSS jrSS jrSS jrSrU =r$ )Number   z
Creates a numeric field for user to enter numbers as input or display numeric output.

Demos: tax_calculator, blocks_simple_squares
NT      )labelinfoeveryinputs
show_label	containerscale	min_widthinteractivevisibleelem_idelem_classesrenderkey	precisionminimummaximumstepc               t   > UU l         UU l        UU l        UU l        [        TU ]  UUUUUUUU	U
UUUUUUS9  g)aw  
Parameters:
    value: default value. If a function is provided, the function will be called each time the app loads to set the initial value of this component.
    label: the label for this component, displayed above the component if `show_label` is `True` and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component corresponds to.
    info: additional component description, appears below the label in smaller font. Supports markdown / HTML syntax.
    every: Continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
    inputs: Components that are used as inputs to calculate `value` if `value` is a function (has no effect otherwise). `value` is recalculated any time the inputs change.
    show_label: if True, will display label.
    container: If True, will place the component in a container - providing some extra padding around the border.
    scale: relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.
    min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
    interactive: if True, will be editable; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.
    visible: If False, component will be hidden.
    elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
    elem_classes: An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
    render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
    key: if assigned, will be used to assume identity across a re-render. Components that have the same key across a re-render will have their value preserved.
    precision: Precision to round input/output to. If set to 0, will round to nearest integer and convert type to int. If None, no rounding happens.
    minimum: Minimum value. Only applied when component is used as an input. If a user provides a smaller value, a gr.Error exception is raised by the backend.
    maximum: Maximum value. Only applied when component is used as an input. If a user provides a larger value, a gr.Error exception is raised by the backend.
    step: The interval between allowed numbers in the component. Can be used along with optional parameters `minimum` and `maximum` to create a range of legal values starting from `minimum` and incrementing according to this parameter.
)r   r   r   r   r   r   r   r   r   r   r   r   r   r    valueN)r!   r"   r#   r$   super__init__)selfr&   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   	__class__s                       i/Users/admin/workspace/ai/PDFMathTranslate/myenv/lib/python3.13/site-packages/gradio/components/number.pyr(   Number.__init__   sa    Z #	!#% 	 	
    c                V    Uc  U $ US:X  a  [        [        X5      5      $ [        X5      $ )z
Round to a given precision.

If precision is None, no rounding happens. If 0, num is converted to int.

Parameters:
    num: Number to round.
    precision: Precision to round to.
Returns:
    rounded number or the original number if precision is None
r   )intround)numr!   s     r+   _round_to_precisionNumber._round_to_precision`   s1     J!^uS,--((r-   c                    Uc  gU R                   b+  XR                   :  a  [        SU SU R                    S35      eU R                  b+  XR                  :  a  [        SU SU R                   S35      eU R                  XR                  5      $ )z
Parameters:
    payload: the field value.
Returns:
    Passes field value as a `float` or `int` into the function, depending on `precision`.
NzValue z is less than minimum value .z is greater than maximum value )r"   r   r#   r2   r!   )r)   payloads     r+   
preprocessNumber.preprocesst   s     ?\\%'LL*@&	)Edll^STUVV\\%'LL*@	!@aP  ''@@r-   c                @    Uc  gU R                  XR                  5      $ )z
Parameters:
    value: Expects an `int` or `float` returned from the function and sets field value to it.
Returns:
    The (optionally rounded) field value as a `float` or `int` depending on `precision`.
N)r2   r!   )r)   r&   s     r+   postprocessNumber.postprocess   s!     =''~~>>r-   c                
    SS0$ )Ntypenumber r)   s    r+   api_infoNumber.api_info   s    !!r-   c                    gN   r?   r@   s    r+   example_payloadNumber.example_payload       r-   c                    grD   r?   r@   s    r+   example_valueNumber.example_value   rH   r-   )r#   r"   r!   r$   )N)&r&   zfloat | Callable | Noner   
str | Noner   rL   r   zTimer | float | Noner   z7Component | Sequence[Component] | set[Component] | Noner   bool | Noner   boolr   
int | Noner   r/   r   rM   r   rN   r   rL   r   zlist[str] | str | Noner   rN   r    zint | str | Noner!   rO   r"   float | Noner#   rP   r$   float)r1   float | intr!   rO   returnrR   )r6   rP   rS   float | int | None)r&   rT   rS   rT   )rS   zdict[str, str])rS   r   )__name__
__module____qualname____firstlineno____doc__r   changeinputsubmitfocusEVENTSr(   staticmethodr2   r7   r:   rA   rF   rJ   __static_attributes____classcell__)r*   s   @r+   r   r      s{    mmV\\6==&,,GF *.B
 !&*JN"& #'"/3 $ $ $ $+B
&B
 	B

 B
 $B
 HB
  B
 B
 B
 B
 !B
 B
 B
 -B
  !B
" #B
$ %B
& 'B
( )B
* +B
 B
H ) )&A"	?" r-   r   N)rY   
__future__r   collections.abcr   r   typingr   r   gradio_client.documentationr   gradio.components.baser	   r
   gradio.eventsr   gradio.exceptionsr   gradio.componentsr   r   r?   r-   r+   <module>rj      sC     " . % 0 ;   #' 
D] D Dr-   