
    0h                        S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKrS SK	J
r
  S SKJr  \R                  (       a  S SKJr  SSKJr   " S S	5      rSS
 jr " S S\5      rg)    )annotationsN)date)	http_date)Response   )Appc                  j    \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	      SS jr
SS	 jrS
rg)JSONProvider   a  A standard set of JSON operations for an application. Subclasses
of this can be used to customize JSON behavior or use different
JSON libraries.

To implement a provider for a specific library, subclass this base
class and implement at least :meth:`dumps` and :meth:`loads`. All
other methods have default implementations.

To use a different provider, either subclass ``Flask`` and set
:attr:`~flask.Flask.json_provider_class` to a provider class, or set
:attr:`app.json <flask.Flask.json>` to an instance of the class.

:param app: An application instance. This will be stored as a
    :class:`weakref.proxy` on the :attr:`_app` attribute.

.. versionadded:: 2.2
c                :    [         R                  " U5      U l        g )N)weakrefproxy_app)selfapps     K/var/www/auris/envauris/lib/python3.13/site-packages/flask/json/provider.py__init__JSONProvider.__init__&   s     s+	    c                    [         e)zySerialize data as JSON.

:param obj: The data to serialize.
:param kwargs: May be passed to the underlying JSON library.
NotImplementedErrorr   objkwargss      r   dumpsJSONProvider.dumps)   
     "!r   c                H    UR                  U R                  " U40 UD65        g)zSerialize data as JSON and write to a file.

:param obj: The data to serialize.
:param fp: A file opened for writing text. Should use the UTF-8
    encoding to be valid JSON.
:param kwargs: May be passed to the underlying JSON library.
N)writer   )r   r   fpr   s       r   dumpJSONProvider.dump1   s     	C*6*+r   c                    [         e)zwDeserialize data as JSON.

:param s: Text or UTF-8 bytes.
:param kwargs: May be passed to the underlying JSON library.
r   r   sr   s      r   loadsJSONProvider.loads;   r   r   c                D    U R                   " UR                  5       40 UD6$ )zDeserialize data as JSON read from a file.

:param fp: A file opened for reading text or UTF-8 bytes.
:param kwargs: May be passed to the underlying JSON library.
)r'   read)r   r!   r   s      r   loadJSONProvider.loadC   s     zz"'').v..r   c                    U(       a  U(       a  [        S5      eU(       d  U(       d  g [        U5      S:X  a  US   $ U=(       d    U$ )Nz9app.json.response() takes either args or kwargs, not both   r   )	TypeErrorlen)r   argsr   s      r   _prepare_response_obj"JSONProvider._prepare_response_objK   s;     FWXXFt9>7N~vr   c                v    U R                  X5      nU R                  R                  U R                  U5      SS9$ )a  Serialize the given arguments as JSON, and return a
:class:`~flask.Response` object with the ``application/json``
mimetype.

The :func:`~flask.json.jsonify` function calls this method for
the current application.

Either positional or keyword arguments can be given, not both.
If no arguments are given, ``None`` is serialized.

:param args: A single value to serialize, or multiple values to
    treat as a list to serialize.
:param kwargs: Treat as a dict to serialize.
application/jsonmimetype)r2   r   response_classr   )r   r1   r   r   s       r   responseJSONProvider.responseY   s7     ((6yy''

3BT'UUr   )r   N)r   r   returnNoner   t.Anyr   r>   r;   str)r   r>   r!   z	t.IO[str]r   r>   r;   r<   r&   zstr | bytesr   r>   r;   r>   )r!   zt.IO[t.AnyStr]r   r>   r;   r>   )r1   ztuple[t.Any, ...]r   zdict[str, t.Any]r;   r>   r1   r>   r   r>   r;   r   )__name__
__module____qualname____firstlineno____doc__r   r   r"   r'   r+   r2   r9   __static_attributes__ r   r   r
   r
      sC    $,","/%/?	Vr   r
   c                   [        U [        5      (       a  [        U 5      $ [        U [        R                  [
        R                  45      (       a  [        U 5      $ [        (       a1  [        R                  " U 5      (       a  [        R                  " U 5      $ [        U S5      (       a  [        U R                  5       5      $ [        S[        U 5      R                   S35      e)N__html__zObject of type z is not JSON serializable)
isinstancer   r   decimalDecimaluuidUUIDr?   dataclassesis_dataclassasdicthasattrrJ   r/   typerB   )os    r   _defaultrV   l   s    !T|!gootyy1221v{{//22!!!$$q*1::<  
od1g&6&6%77PQ
RRr   c                  v    \ rS rSr% Sr\" \5      rS\S'    Sr	 Sr
 SrS\S'    S	r SS
 jrSS jrSS jrSrg)DefaultJSONProvider|   a  Provide JSON operations using Python's built-in :mod:`json`
library. Serializes the following additional data types:

-   :class:`datetime.datetime` and :class:`datetime.date` are
    serialized to :rfc:`822` strings. This is the same as the HTTP
    date format.
-   :class:`uuid.UUID` is serialized to a string.
-   :class:`dataclasses.dataclass` is passed to
    :func:`dataclasses.asdict`.
-   :class:`~markupsafe.Markup` (or any object with a ``__html__``
    method) will call the ``__html__`` method to get a string.
zt.Callable[[t.Any], t.Any]defaultTNzbool | Nonecompactr5   c                    UR                  SU R                  5        UR                  SU R                  5        UR                  SU R                  5        [        R
                  " U40 UD6$ )a  Serialize data as JSON to a string.

Keyword arguments are passed to :func:`json.dumps`. Sets some
parameter defaults from the :attr:`default`,
:attr:`ensure_ascii`, and :attr:`sort_keys` attributes.

:param obj: The data to serialize.
:param kwargs: Passed to :func:`json.dumps`.
rZ   ensure_ascii	sort_keys)
setdefaultrZ   r]   r^   jsonr   r   s      r   r   DefaultJSONProvider.dumps   sV     	)T\\2.$*;*;<+t~~6zz#(((r   c                0    [         R                  " U40 UD6$ )z~Deserialize data as JSON from a string or bytes.

:param s: Text or UTF-8 bytes.
:param kwargs: Passed to :func:`json.loads`.
)r`   r'   r%   s      r   r'   DefaultJSONProvider.loads   s     zz!&v&&r   c                P   U R                  X5      n0 nU R                  c  U R                  R                  (       d  U R                  SL a  UR	                  SS5        OUR	                  SS5        U R                  R                  U R                  " U40 UD6 S3U R                  S9$ )a)  Serialize the given arguments as JSON, and return a
:class:`~flask.Response` object with it. The response mimetype
will be "application/json" and can be changed with
:attr:`mimetype`.

If :attr:`compact` is ``False`` or debug mode is enabled, the
output will be formatted to be easier to read.

Either positional or keyword arguments can be given, not both.
If no arguments are given, ``None`` is serialized.

:param args: A single value to serialize, or multiple values to
    treat as a list to serialize.
:param kwargs: Treat as a dict to serialize.
Findentr   
separators),:
r6   )r2   r[   r   debugr_   r8   r   r7   )r   r1   r   r   	dump_argss        r   r9   DefaultJSONProvider.response   s      ((6&(	LL TYY__9N  1-  z:yy''zz#++,B/$-- ( 
 	
r   rH   r=   r@   rA   )rB   rC   rD   rE   rF   staticmethodrV   rZ   __annotations__r]   r^   r[   r7   r   r'   r9   rG   rH   r   r   rX   rX   |   s`     +7x*@G'@
 L
 I  G[
 "H/)'
r   rX   )rU   r>   r;   r>   )
__future__r   rP   rL   r`   typingtrN   r   datetimer   werkzeug.httpr   TYPE_CHECKINGwerkzeug.sansio.responser   
sansio.appr   r
   rV   rX   rH   r   r   <module>rw      sP    "        #??1 VV VVrS [
, [
r   