
    daf                     r    d Z ddlZddlmZ dddddd	Zd
 ZdedefdZdedefdZdedefdZ	dedefdZ
y)z8Utilities for tests that are in the "burntsushi" format.    N)Anybooldatetimedatetime-local
date-local
time-local)booleanzoffset datetimezlocal datetimez
local datez
local timec                 J   t        | t              rd| dS t        | t              rdt        |       j                         dS t        | t              rdt        |       dS t        | t
              rdt        t        |             dS t        | t        j                        r/t        | j                               }| j                  rd|dS d|dS t        | t        j                        rdt        t        |             dS t        | t        j                        rd	t        |       dS t        | t              r| D cg c]  }t        |       c}S t        | t               r-| j#                         D ci c]  \  }}|t        |       c}}S t%        d
      c c}w c c}}w )Nstringtypevaluer   integerfloatr   r   r   r   zunsupported type)
isinstancestrr   lowerintr   _normalize_float_strr   _normalize_datetime_str	isoformattzinfotime_normalize_localtime_strdatelistconvertdictitems	Exception)objvalikvs        7/root/Python-3.12.4/Lib/test/test_tomllib/burntsushi.pyr   r      sY   #s 3//	C	S)9::	C	!CH55	C	*>s3x*HII	C**	+%cmmo6::&55(377	C	' -c#h7
 	
 
C	' X
 	
 
C	$'(q
((	C	*-))+6$!Q71:66
&
'' )6s   =F5Fr!   returnc                    t        | t              r| D cg c]  }t        |       c}S t        | t              rd| v r{d| v rw| d   }t        j                  ||      }| d   }|dk(  rt        |      }n#|dv rt        |      }n|dk(  rt        |      }n|}|dk(  r|D cg c]  }t        |       c}S ||dS | j                         D ci c]  \  }}|t        |       c}}S t        d      c c}w c c}w c c}}w )	a  Normalize test objects.

    This normalizes primitive values (e.g. floats), and also converts from
    TOML compliance format [1] to BurntSushi format [2].

    [1] https://github.com/toml-lang/compliance/blob/db7c3211fda30ff9ddb10292f4aeda7e2e10abc4/docs/json-encoding.md  # noqa: E501
    [2] https://github.com/BurntSushi/toml-test/blob/4634fdf3a6ecd6aaea5f4cdcd98b2733c2694993/README.md  # noqa: E501
    r   r   r   >   r   r   r   arrayr   z.Burntsushi fixtures should be dicts/lists only)r   r   	normalizer   _aliasesgetr   r   r   r   AssertionError)r!   itemtype_	norm_typer   
norm_valuer$   r%   s           r&   r*   r*   5   s     #t,/0D	$00#tS=W^KE UE2ILEG#1%8
<<4U;
l*5e<
"
G#49:D	$::%
;;,/IIK8DAq9Q<88
I
JJ' 1  ;8s   C1C6C;dt_strc                     | d   j                         dk(  r| d d dz   } | d d }| dd  }d|v rd}n	d|v rd}nd}|r|j                  |      \  }}}n|}d}d	|v r|j                  d
      n|}|dz   |z   |z   |z   S )Nzz+00:00
      +- .0T)r   	partitionrstrip)r2   r   restsignr   _offsets          r&   r   r   U   s    bzS x'#2;D"#;D
d{	...a"d{4;;sD#:t#f,,    lt_strc                 0    d| v r| j                  d      S | S )Nr;   r<   )r?   )rE   s    r&   r   r   m   s    !$6==:F:rD   	float_strc                 :    t        |       }|dk(  ryt        |      S )Nr   r<   )r   r   )rG   as_floats     r&   r   r   q   s"    YH 1}x=rD   )__doc__r   typingr   r+   r   r*   r   r   r   r    rD   r&   <module>rM      s}   
 ?   !&(>K3 K3 K@-C -C -0;S ;S ;C C rD   