
    h                    d   S SK Jr  S SKrS SKJrJrJrJr  SSK	J
rJrJr  \(       a  S SKJrJrJrJrJr  S SKJr  SrS	 rS
 rS rSSS.       SS jjr\" S5      r\SSS.       SS jj5       r\SSSS.         SS jj5       r\SSSS.         SS jj5       r\SSS.S jrg)    )annotationsN)TYPE_CHECKINGoverloadTypeVarAny   )DecodeErrorconvertto_builtins)CallableOptionalTypeUnionLiteral)Buffer)encodedecodec                     [         $ N)__all__     F/home/james-whalen/.local/lib/python3.13/site-packages/msgspec/toml.py__dir__r      s    Nr   c                 r     SS K n U $ ! [         a     Of = f SS KnU$ ! [         a    [        S5      S ef = f)Nr   z`msgspec.toml.decode` requires `tomli` be installed.

Please either `pip` or `conda` install it as follows:

  $ python -m pip install tomli   # using pip
  $ conda install tomli           # or using conda)tomllibImportErrortomli)r   r   s     r   _import_tomllibr      sU     
 A

 	s    
 6c                 D     SS K n U $ ! [         a    [        S5      S ef = f)Nr   z`msgspec.toml.encode` requires `tomli_w` be installed.

Please either `pip` or `conda` install it as follows:

  $ python -m pip install tomli_w   # using pip
  $ conda install tomli_w           # or using conda)tomli_wr   )r!   s    r   _import_tomli_wr"   -   s6    
 C

 	s    )enc_hookorderc                   [        5       n[        U [        R                  [        R                  [        R
                  4SUUS9nUR                  U5      R                  S5      $ )aI  Serialize an object as TOML.

Parameters
----------
obj : Any
    The object to serialize.
enc_hook : callable, optional
    A callable to call for objects that aren't supported msgspec types.
    Takes the unsupported object and should return a supported object, or
    raise a ``NotImplementedError`` if unsupported.
order : {None, 'deterministic', 'sorted'}, optional
    The ordering to use when encoding unordered compound types.

    - ``None``: All objects are encoded in the most efficient manner
      matching their in-memory representations. The default.
    - `'deterministic'`: Unordered collections (sets, dicts) are sorted to
      ensure a consistent output between runs. Useful when
      comparison/hashing of the encoded binary output is necessary.
    - `'sorted'`: Like `'deterministic'`, but *all* object-like types
      (structs, dataclasses, ...) are also sorted by field name before
      encoding. This is slower than `'deterministic'`, but may produce more
      human-readable output.

Returns
-------
data : bytes
    The serialized object.

See Also
--------
decode
T)builtin_typesstr_keysr#   r$   utf-8)r"   _to_builtins	_datetimedatetimedatetimedumpsr   )objr#   r$   tomlmsgs        r   r   r   ;   sV    L D
 ))9>>9>>JC ::c?!!'**r   TT)strictdec_hookc                   g r   r   )bufr3   r4   s      r   r   r   o   s     	r   .)typer3   r4   c                   g r   r   r6   r7   r3   r4   s       r   r   r   y        	r   c                   g r   r   r9   s       r   r   r      r:   r   c          	        [        5       n[        U [        5      (       a  U nOP[        U [        [        45      (       a  U R                  S5      nO#[        [        U 5      5      R                  S5      n UR                  U5      nU[        L a  U$ [        UU[        R                  [        R                  [        R                  4SUUS9$ ! UR                   a  n[        [        U5      5      SeSnAff = f)a.  Deserialize an object from TOML.

Parameters
----------
buf : bytes-like or str
    The message to decode.
type : type, optional
    A Python type (in type annotation form) to decode the object as. If
    provided, the message will be type checked and decoded as the specified
    type. Defaults to `Any`, in which case the message will be decoded
    using the default TOML types.
strict : bool, optional
    Whether type coercion rules should be strict. Setting to False enables
    a wider set of coercion rules from string to non-string types for all
    values. Default is True.
dec_hook : callable, optional
    An optional callback for handling decoding custom types. Should have
    the signature ``dec_hook(type: Type, obj: Any) -> Any``, where ``type``
    is the expected message type, and ``obj`` is the decoded representation
    composed of only basic TOML types. This hook should transform ``obj``
    into type ``type``, or raise a ``NotImplementedError`` if unsupported.

Returns
-------
obj : Any
    The deserialized object.

See Also
--------
encode
r(   NT)r&   r'   r3   r4   )r   
isinstancestrbytes	bytearrayr   
memoryviewloadsTOMLDecodeError_DecodeErrorr   _convertr*   r+   r,   r-   )r6   r7   r3   r4   r0   str_bufr/   excs           r   r   r      s    @ D#s	C%+	,	,**W% 
3(//8/jj! s{
 ))9>>9>>J   /3s8$$./s   4C C5C00C5)r/   r   r#   zOptional[Callable[[Any], Any]]r$   z(Literal[None, 'deterministic', 'sorted']returnr?   )r6   Union[Buffer, str]r3   boolr4   $Optional[Callable[[type, Any], Any]]rH   r   )
r6   rI   r7   zType[T]r3   rJ   r4   rK   rH   r2   )
r6   rI   r7   r   r3   rJ   r4   rK   rH   r   )
__future__r   r+   r*   typingr   r   r   r    r	   rD   r
   rE   r   r)   r   r   r   r   r   typing_extensionsr   r   r   r   r"   r   r2   r   r   r   r   <module>rP      sl   "  8 8  ??( *" 046:	.+	.+ -.+ 4	.+
 .+b CL 
 59				 	 3		
 		 
	 
 59			 	 		
 3	 	 
	 
 59			 	 		
 3	 		 
	 D4 6r   