Format: application/x-python-code
⬇ Download File (5.8 KB)
   1  o
   2  
   3  D'h��@s|ddlmZddlZddlZddlmZddlm	Z	ej
   4  r#ddlmZdd
   5  d�Z
   6  d dd�Zd!dd�Zd"dd�Zd#dd�ZdS)$�)�annotationsN�)�current_app�)�_default)�Response�obj�t.Any�kwargs�return�strcKs6trtjj|fi|��S|�dt�tj|fi|��S)aFSerialize data as JSON.
   7  
   8      If :data:`~flask.current_app` is available, it will use its
   9      :meth:`app.json.dumps() <flask.json.provider.JSONProvider.dumps>`
  10      method, otherwise it will use :func:`json.dumps`.
  11  
  12      :param obj: The data to serialize.
  13      :param kwargs: Arguments passed to the ``dumps`` implementation.
  14  
  15      .. versionchanged:: 2.3
  16          The ``app`` parameter was removed.
  17  
  18      .. versionchanged:: 2.2
  19          Calls ``current_app.json.dumps``, allowing an app to override
  20          the behavior.
  21  
  22      .. versionchanged:: 2.0.2
  23          :class:`decimal.Decimal` is supported by converting to a string.
  24  
  25      .. versionchanged:: 2.0
  26          ``encoding`` will be removed in Flask 2.1.
  27  
  28      .. versionchanged:: 1.0.3
  29          ``app`` can be passed directly, rather than requiring an app
  30          context for configuration.
  31      �default)r�json�dumps�
  32  setdefaultr�_json)rr
  33  �r�IC:\Users\shubh\Videos\agent\nova\Lib\site-packages\flask/json/__init__.pyr
  34  sr�fp�	t.IO[str]�NonecKsBtrtjj||fi|��dS|�dt�tj||fi|��dS)aSerialize data as JSON and write to a file.
  35  
  36      If :data:`~flask.current_app` is available, it will use its
  37      :meth:`app.json.dump() <flask.json.provider.JSONProvider.dump>`
  38      method, otherwise it will use :func:`json.dump`.
  39  
  40      :param obj: The data to serialize.
  41      :param fp: A file opened for writing text. Should use the UTF-8
  42          encoding to be valid JSON.
  43      :param kwargs: Arguments passed to the ``dump`` implementation.
  44  
  45      .. versionchanged:: 2.3
  46          The ``app`` parameter was removed.
  47  
  48      .. versionchanged:: 2.2
  49          Calls ``current_app.json.dump``, allowing an app to override
  50          the behavior.
  51  
  52      .. versionchanged:: 2.0
  53          Writing to a binary file, and the ``encoding`` argument, will be
  54          removed in Flask 2.1.
  55      r
  56  N)rr�dumprrr)rrr
  57  rrrr/sr�s�str | bytescK�*trtjj|fi|��Stj|fi|��S)aDeserialize data as JSON.
  58  
  59      If :data:`~flask.current_app` is available, it will use its
  60      :meth:`app.json.loads() <flask.json.provider.JSONProvider.loads>`
  61      method, otherwise it will use :func:`json.loads`.
  62  
  63      :param s: Text or UTF-8 bytes.
  64      :param kwargs: Arguments passed to the ``loads`` implementation.
  65  
  66      .. versionchanged:: 2.3
  67          The ``app`` parameter was removed.
  68  
  69      .. versionchanged:: 2.2
  70          Calls ``current_app.json.loads``, allowing an app to override
  71          the behavior.
  72  
  73      .. versionchanged:: 2.0
  74          ``encoding`` will be removed in Flask 2.1. The data must be a
  75          string or UTF-8 bytes.
  76  
  77      .. versionchanged:: 1.0.3
  78          ``app`` can be passed directly, rather than requiring an app
  79          context for configuration.
  80      )rr�loadsr)rr
  81  rrrrMsr�t.IO[t.AnyStr]cKr)aDeserialize data as JSON read from a file.
  82  
  83      If :data:`~flask.current_app` is available, it will use its
  84      :meth:`app.json.load() <flask.json.provider.JSONProvider.load>`
  85      method, otherwise it will use :func:`json.load`.
  86  
  87      :param fp: A file opened for reading text or UTF-8 bytes.
  88      :param kwargs: Arguments passed to the ``load`` implementation.
  89  
  90      .. versionchanged:: 2.3
  91          The ``app`` parameter was removed.
  92  
  93      .. versionchanged:: 2.2
  94          Calls ``current_app.json.load``, allowing an app to override
  95          the behavior.
  96  
  97      .. versionchanged:: 2.2
  98          The ``app`` parameter will be removed in Flask 2.3.
  99  
 100      .. versionchanged:: 2.0
 101          ``encoding`` will be removed in Flask 2.1. The file must be text
 102          mode, or binary mode with UTF-8 bytes.
 103      )rr�loadr)rr
 104  rrrrlsr�argsrcOstjj|i|��S)a�Serialize the given arguments as JSON, and return a
 105      :class:`~flask.Response` object with the ``application/json``
 106      mimetype. A dict or list returned from a view will be converted to a
 107      JSON response automatically without needing to call this.
 108  
 109      This requires an active request or application context, and calls
 110      :meth:`app.json.response() <flask.json.provider.JSONProvider.response>`.
 111  
 112      In debug mode, the output is formatted with indentation to make it
 113      easier to read. This may also be controlled by the provider.
 114  
 115      Either positional or keyword arguments can be given, not both.
 116      If no arguments are given, ``None`` is serialized.
 117  
 118      :param args: A single value to serialize, or multiple values to
 119          treat as a list to serialize.
 120      :param kwargs: Treat as a dict to serialize.
 121  
 122      .. versionchanged:: 2.2
 123          Calls ``current_app.json.response``, allowing an app to override
 124          the behavior.
 125  
 126      .. versionchanged:: 2.0.2
 127          :class:`decimal.Decimal` is supported by converting to a string.
 128  
 129      .. versionchanged:: 0.11
 130          Added support for serializing top-level arrays. This was a
 131          security risk in ancient browsers. See :ref:`security-json`.
 132  
 133      .. versionadded:: 0.2
 134      )rr�response)rr
 135  rrr�jsonify�s r )rr	r
 136  r	rr)rr	rrr
 137  r	rr)rrr
 138  r	rr	)rrr
 139  r	rr	)rr	r
 140  r	rr)�
 141  __future__rrr�typing�t�globalsr�providerr�
 142  TYPE_CHECKINGZwrappersrrrrrr rrrr�<module>s
 143  
 144  "
 145  
 146