
    \jc                         d dl mZm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y)   )SchemaStrategyTypedSchemaStrategyc                   0    e Zd ZdZed        Zed        Zy)Typelessz
    schema strategy for schemas with no type. This is only used when
    there is no other active strategy, and it will be merged into the
    first typed strategy that gets added.
    c                 
    d|vS Ntype clsschemas     I/root/env/lib/python3.12/site-packages/genson/schema/strategies/scalar.pymatch_schemazTypeless.match_schema   s    V##    c                      y)NFr
   r   objs     r   match_objectzTypeless.match_object   s    r   N)__name__
__module____qualname____doc__classmethodr   r   r
   r   r   r   r      s/     $ $  r   r   c                   $    e Zd ZdZdZ ed      Zy)Nullz#
    strategy for null schemas
    nullN)r   r   r   r   JS_TYPEr	   PYTHON_TYPEr
   r   r   r   r      s     Gt*Kr   r   c                       e Zd ZdZdZeZy)Booleanz&
    strategy for boolean schemas
    booleanN)r   r   r   r   r   boolr   r
   r   r   r    r       s     GKr   r    c                       e Zd ZdZdZeZy)StringzK
    strategy for string schemas - works for ascii and unicode strings
    stringN)r   r   r   r   r   strr   r
   r   r   r$   r$   $   s     GKr   r$   c                   h     e Zd ZdZdZeefZed        Z	ed        Z
 fdZ fdZd Z fdZ xZS )	Numberz
    strategy for integer and number schemas. It automatically
    converts from `integer` to `number` when a float object or a
    number schema is added
    )integernumberc                 <    |j                  d      | j                  v S r   )getJS_TYPESr   s     r   r   zNumber.match_schema5   s    zz&!S\\11r   c                 0    t        |      | j                  v S )N)r	   PYTHON_TYPESr   s     r   r   zNumber.match_object9   s     CyC,,,,r   c                 2    t         |   |       d| _        y )Nr)   )super__init___type)self
node_class	__class__s     r   r2   zNumber.__init__>   s    $
r   c                 \    t         |   |       |j                  d      dk(  rd| _        y y )Nr	   r*   )r1   
add_schemar,   r3   r4   r   r6   s     r   r8   zNumber.add_schemaB   s-    6"::f)!DJ *r   c                 4    t        |t              rd| _        y y )Nr*   )
isinstancefloatr3   )r4   r   s     r   
add_objectzNumber.add_objectG   s    c5!!DJ "r   c                 B    t         |          }| j                  |d<   |S r   )r1   	to_schemar3   r9   s     r   r?   zNumber.to_schemaK   s"    "$vr   )r   r   r   r   r-   intr<   r/   r   r   r   r2   r8   r=   r?   __classcell__)r6   s   @r   r(   r(   ,   sW    
 %H<L2 2 - -"
" r   r(   N)baser   r   r   r   r    r$   r(   r
   r   r   <module>rC      sG    5~   !   "^ "r   