Files
aitsc/.venv/Lib/site-packages/flask/json/__pycache__/provider.cpython-312.pyc

119 lines
9.0 KiB
Plaintext
Raw Normal View History

2025-02-23 09:07:52 +08:00
<EFBFBD>
2025-08-17 18:52:05 +08:00
-<2D><>h<EFBFBD><00><01><><00>ddlmZddlZddlZddlZddlZddlZddlZddl m
2025-02-23 09:07:52 +08:00
Z
ddl m Z ejr ddlmZddlmZGd<08>d <09>Zd d
<EFBFBD>ZGd <0B>d e<12>Zy)<0E>)<01> annotationsN)<01>date)<01> http_date)<01>Response<73>)<01>Appc<01>T<00>eZdZdZd
d<02>Zd d<03>Zd d<04>Zd d<05>Zdd<06>Z dd<07>Z dd<08>Z
y )<11> JSONProvidera<72>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
2025-08-16 19:28:45 +08:00
c<01>8<00>tj|<01>|_y)N)<03>weakref<65>proxy<78>_app)<02>self<6C>apps <20>7D:\aitsc\.venv\Lib\site-packages\flask\json\provider.py<70>__init__zJSONProvider.__init__&s<00><00> <20><1D><1D>s<EFBFBD>+<2B><04> <09>c <01><00>t<00>)z<>Serialize data as JSON.
2025-02-23 09:07:52 +08:00
:param obj: The data to serialize.
:param kwargs: May be passed to the underlying JSON library.
<20><01>NotImplementedError<6F>r<00>obj<62>kwargss r<00>dumpszJSONProvider.dumps)<00>
<00><00> "<22>!rc <01>H<00>|j|j|fi|<03><01><01>y)aSerialize 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)<02>writer)rr<00>fprs r<00>dumpzJSONProvider.dump1s <00><00> <0B><08><08><1A><14><1A><1A>C<EFBFBD>*<2A>6<EFBFBD>*<2A>+rc <01><00>t<00>)z<>Deserialize data as JSON.
:param s: Text or UTF-8 bytes.
:param kwargs: May be passed to the underlying JSON library.
r<00>r<00>srs r<00>loadszJSONProvider.loads;rrc <01>D<00>|j|j<00>fi|<02><01>S)z<>Deserialize 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#<00>read)rrrs r<00>loadzJSONProvider.loadCs <00><00> <1A>t<EFBFBD>z<EFBFBD>z<EFBFBD>"<22>'<27>'<27>)<29>.<2E>v<EFBFBD>.<2E>.rc<01>\<00>|r |r td<01><00>|s|syt|<01>dk(r|dS|xs|S)Nz9app.json.response() takes either args or kwargs, not both<74>r)<02> TypeError<6F>len)r<00>argsrs r<00>_prepare_response_objz"JSONProvider._prepare_response_objKs;<00><00> <10>F<EFBFBD><1B>W<>X<> X<><13>F<EFBFBD><17> <0E>t<EFBFBD>9<EFBFBD><01>><3E><17><01>7<EFBFBD>N<EFBFBD><13>~<7E>v<EFBFBD>rc<01>~<00>|j||<02>}|jj|j|<03>d<01><02>S)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.
<20>application/json<6F><01>mimetype)r,r<00>response_classr)rr+rrs r<00>responsezJSONProvider.responseYs9<00><00><13>(<28>(<28><14>v<EFBFBD>6<><03><13>y<EFBFBD>y<EFBFBD>'<27>'<27><04>
<EFBFBD>
<EFBFBD>3<EFBFBD><0F>BT<42>'<27>U<>UrN)rr<00>return<72>None<6E>r<00>t.Anyrr6r3<00>str)rr6rz t.IO[str]rr6r3r4<00>r"z str | bytesrr6r3r6)rzt.IO[t.AnyStr]rr6r3r6)r+ztuple[t.Any, ...]rzdict[str, t.Any]r3r6<00>r+r6rr6r3r) <0B>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rrrr#r&r,r2<00>rrr
r
sC<00><00><08>$,<2C>"<22>,<2C>"<22>/<2F> <1E>%<25> <1E>/?<3F> <1E> <0E> <1E>Vrr
c<01><><00>t|t<00>r t|<00>St|tjt
j f<02>r t|<00>Str*tj|<00>rtj|<00>St|d<01>rt|j<00><00>Stdt|<00>j<00>d<03><03><00>)N<>__html__zObject of type z is not JSON serializable)<10>
isinstancerr<00>decimal<61>Decimal<61>uuid<69>UUIDr7<00> dataclasses<65> is_dataclass<73>asdict<63>hasattrr@r)<00>typer:)<01>os r<00>_defaultrLls<><00><00><11>!<21>T<EFBFBD><1A><18><11>|<7C><1B><11>!<21>g<EFBFBD>o<EFBFBD>o<EFBFBD>t<EFBFBD>y<EFBFBD>y<EFBFBD>1<>2<><12>1<EFBFBD>v<EFBFBD> <0A><12>{<7B>/<2F>/<2F><01>2<><1A>!<21>!<21>!<21>$<24>$<24><0E>q<EFBFBD>*<2A><1D><12>1<EFBFBD>:<3A>:<3A><<3C> <20> <20>
<13>o<EFBFBD>d<EFBFBD>1<EFBFBD>g<EFBFBD>&6<>&6<>%7<>7P<37>Q<>
R<EFBFBD>Rrc<01>h<00>eZdZUdZee<05>Zded< dZ dZ dZ
ded< dZ d d <09>Z d d
<EFBFBD>Z dd <0B>Zy)<0F>DefaultJSONProvidera4Provide 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.
zt.Callable[[t.Any], t.Any]<5D>defaultTNz bool | None<6E>compactr.c <01><><00>|jd|j<00>|jd|j<00>|jd|j<00>t j
|fi|<02><01>S)aISerialize 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`.
rO<00> ensure_ascii<69> sort_keys)<06>
setdefaultrOrRrS<00>jsonrrs rrzDefaultJSONProvider.dumps<70>sV<00><00> <0F><19><19>)<29>T<EFBFBD>\<5C>\<5C>2<><0E><19><19>.<2E>$<24>*;<3B>*;<3B><<3C><0E><19><19>+<2B>t<EFBFBD>~<7E>~<7E>6<><13>z<EFBFBD>z<EFBFBD>#<23>(<28><16>(<28>(rc <01>.<00>tj|fi|<02><01>S)z<>Deserialize data as JSON from a string or bytes.
:param s: Text or UTF-8 bytes.
:param kwargs: Passed to :func:`json.loads`.
)rUr#r!s rr#zDefaultJSONProvider.loads<64>s<00><00> <14>z<EFBFBD>z<EFBFBD>!<21>&<26>v<EFBFBD>&<26>&rc<01>J<00>|j||<02>}i}|j<00>|jjs|jdur|j dd<03>n|j dd<05>|jj |j |fi|<04><01><01>d<06>|j<00><07>S)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<00>
separators)<02>,<2C>:<3A>
r/)r,rPr<00>debugrTr1rr0)rr+rr<00> dump_argss rr2zDefaultJSONProvider.response<73>s<><00><00> <13>(<28>(<28><14>v<EFBFBD>6<><03>&(<28> <09> <10>L<EFBFBD>L<EFBFBD> <20>T<EFBFBD>Y<EFBFBD>Y<EFBFBD>_<EFBFBD>_<EFBFBD><14><1C><1C><15>9N<39> <15> <20> <20><18>1<EFBFBD> -<2D> <15> <20> <20><1C>z<EFBFBD> :<3A><13>y<EFBFBD>y<EFBFBD>'<27>'<27><19>t<EFBFBD>z<EFBFBD>z<EFBFBD>#<23>+<2B><19>+<2B>,<2C>B<EFBFBD> /<2F>$<24>-<2D>-<2D>(<28>
<EFBFBD>
rr5r8r9)r:r;r<r=<00> staticmethodrLrO<00>__annotations__rRrSrPr0rr#r2r>rrrNrN|s`<00><00> <08>+7<>x<EFBFBD>*@<40>G<EFBFBD> '<27>@<40><08>
<18>L<EFBFBD><08>
<15>I<EFBFBD><08>  <20>G<EFBFBD>[<5B><1F><08>
"<22>H<EFBFBD>/<2F> )<29>'<27>
rrN)rKr6r3r6)<15>
__future__rrFrBrU<00>typing<6E>trDr <00>datetimer<00> werkzeug.httpr<00> TYPE_CHECKING<4E>werkzeug.sansio.responser<00>
sansio.apprr
rLrNr>rr<00><module>risP<00><01>"<22><12><0E> <0B><12> <0B><0E><19>#<23><04>?<3F>?<3F>1<> <20>VV<01>VV<01>r S<01> [
<EFBFBD>,<2C>[
r