
    gW                     \    d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z
  G d de
      Z	d	 Zy)
z#
Serialize data to/from JSON Lines
    N)DeserializationError)DjangoJSONEncoder)Deserializer)
Serializerc                   8     e Zd ZdZdZd Zd Zd Z fdZ xZ	S )r   z!Convert a queryset to JSON Lines.Fc                    d | _         | j                  j                         | _        | j                  j	                  dd        | j                  j	                  dd        | j                  j	                  dd        d| j                  d<   | j                  j                  dt               | j                  j                  dd       y )	Nstreamfieldsindent),z: 
separatorsclsensure_asciiF)_currentoptionscopyjson_kwargspop
setdefaultr   selfs    u/var/www/python.vincentserveurtest.ovh/public_html/venv/lib/python3.12/site-packages/django/core/serializers/jsonl.py_init_optionszSerializer._init_options   s    <<,,.Xt,Xt,Xt,)4&##E+<=##NE:    c                 $    | j                          y N)r   r   s    r   start_serializationzSerializer.start_serialization   s    r   c                     t        j                  | j                  |      | j                  fi | j                   | j                  j                  d       d | _        y )N
)jsondumpget_dump_objectr	   r   writer   )r   objs     r   
end_objectzSerializer.end_object   sC    		$&&s+T[[MD<L<LM$r   c                 (    t         t        |          S r   )superPythonSerializergetvalue)r   	__class__s    r   r)   zSerializer.getvalue%   s    %t577r   )
__name__
__module____qualname____doc__internal_use_onlyr   r   r%   r)   __classcell__)r*   s   @r   r   r      s%    +;8 8r   r   c              +   v  K   t        | t              r| j                         } t        | t        t        f      r| j	                  d      } | D ]<  }|j                         s	 t        t        j                  |      gfi |E d{    > y7 # t        t        f$ r  t        $ r}t               |d}~ww xY ww)z,Deserialize a stream or string of JSON data.r   N)
isinstancebytesdecodestrsplitstripPythonDeserializerr    loadsGeneratorExitr   	Exception)stream_or_stringr   lineexcs       r   r   r   *   s     "E*+224"UCL1+11$7 zz|	2)4::d+;*<HHHH	 ! I34 	 	2&(c1	2s<   AB9!#BBB	B9BB6&B11B66B9)r.   r    django.core.serializers.baser   django.core.serializers.jsonr   django.core.serializers.pythonr   r8   r   r(    r   r   <module>rC      s-     = : M I8! 8:2r   