Files
cms-website/.deps_siteforge_v812/fastapi/__pycache__/encoders.cpython-312.pyc
T

106 lines
11 KiB
Plaintext
Raw Normal View History

Ë
ñÅÙj4+ãó—UddlZddlZddlmZmZddlmZddlmZddl m
Z
m Z m Z m
Z
mZmZddlmZmZddlmZddlmZdd lmZmZmZmZmZdd
lmZdd lm Z dd l!m"Z"dd
l#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*m+Z+ddl,m-Z-m.Z.ddl/m0Z0ddl1m2Z2m3Z3deejhejjfde6fd„Z7dedee8e9ffd„Z:ie;d„“e(e6“ejhe7“eje7“ejje7“ejxd„“ee:“ed„“e=e>“ee>“ee>“e
e6“e e6“e e6“e
e6“ee6“ee6“e+e6ee6ed„e-e6e.e6e?e>ee6e2e6e*e6i ¥Z@eAeBeeegeffeCd<deAeeegeffdeAeegefeDed fffd!„ZEeEe@«ZF d5d"eee d#«fd$eee$e d%«fd&eee$e d'«fd(eeGe d)«fd*eeGe d+«fd,eeGe d-«fd.eeGe d/«fd0eeeAeeegeffe d1«fd2eeGe d3«fdefd4„ZHy)6éN)Ú defaultdictÚdeque)ÚDecimal)ÚEnum)Ú IPv4AddressÚ
IPv4InterfaceÚ IPv4NetworkÚ IPv6AddressÚ
IPv6InterfaceÚ IPv6Network)ÚPathÚPurePath)ÚPattern)Ú
GeneratorType)Ú AnnotatedÚAnyÚCallableÚOptionalÚUnion)ÚUUID)ÚDoc)ÚPydanticV1NotSupportedError)ÚIncEx)Ú BaseModel)ÚColor)ÚAnyUrlÚ NameEmail)Ú SecretBytesÚ SecretStr)ÚPydanticUndefinedTypeé)ÚUrlÚis_pydantic_v1_model_instanceÚoÚreturncó"—|j«S©N)Ú isoformat©r$s úTC:\Users\30997\AppData\Local\Temp\pip-target-6g32zz5s\lib\python\fastapi/encoders.pyr(r($s€Ø �;‰;‹=ÐóÚ dec_valuecóŒ—|j«j}t|t«r|dk\r t|«St |«S)aÜ
Encodes a Decimal as int if there's no exponent, otherwise float
This is useful when we use ConstrainedDecimal to represent Numeric(x,0)
where an integer (but not int typed) is used. Encoding this as a float
results in failed round-tripping between encode and parse.
Our Id type is a prime example of this.
>>> decimal_encoder(Decimal("1.0"))
1.0
>>> decimal_encoder(Decimal("1"))
1
>>> decimal_encoder(Decimal("NaN"))
nan
r)Úas_tupleÚexponentÚ
isinstanceÚintÚfloat)r,r/s r*Údecimal_encoderr3*s=€ð$×!Ñ!Ó#×,Ñ,€HÜ�(œCÔ  X°¢]Ü�9‹~Ðä�YÓÐr+có"—|j«Sr')Údecoder)s r*Ú<lambda>r6Ds
€�Q—X‘X”Zr+có"—|j«Sr')Ú
total_seconds)Útds r*r6r6Is
€ 2×#3Ñ#3Ô#5r+có—|jSr')Úvaluer)s r*r6r6Ks€�A—G’Gr+có—|jSr')Úpatternr)s r*r6r6Ws€�q—y’yr+ÚENCODERS_BY_TYPEÚtype_encoder_map.cóp—tt«}|j«D]\}}||xx|fz
cc<Œ|Sr')rÚtupleÚitems)r?Úencoders_by_class_tuplesÚtype_Úencoders r*Ú!generate_encoders_by_class_tuplesrFasF€ôMXÜ
óMÐð+×0Ñ0Ö2‰ˆˆwØ  Ó)¨e¨XÑ5Ô)ð3à #Ð#r+Úobjz>
The input object to convert to JSON.
Úincludez}
Pydantic's `include` parameter, passed to Pydantic models to set the
fields to include.
Úexcludez}
Pydantic's `exclude` parameter, passed to Pydantic models to set the
fields to exclude.
Úby_aliasap
Pydantic's `by_alias` parameter, passed to Pydantic models to define if
the output should use the alias names (when provided) or the Python
attribute names. In an API, if you set an alias, it's probably because you
want to use it in the result, so you probably want to leave this set to
`True`.
Ú
exclude_unsetzò
Pydantic's `exclude_unset` parameter, passed to Pydantic models to define
if it should exclude from the output the fields that were not explicitly
set (and that only had their default values).
Úexclude_defaultszó
Pydantic's `exclude_defaults` parameter, passed to Pydantic models to define
if it should exclude from the output the fields that had the same default
value, even when they were explicitly set.
Ú exclude_nonez¸
Pydantic's `exclude_none` parameter, passed to Pydantic models to define
if it should exclude from the output any fields that have a `None` value.
Úcustom_encoderz‚
Pydantic's `custom_encoder` parameter, passed to Pydantic models to define
a custom encoder.
Úsqlalchemy_safeaO
Exclude from the output any fields that start with the name `_sa`.
This is mainly a hack for compatibility with SQLAlchemy objects, they
store internal SQLAlchemy-specific state in attributes named with `_sa`,
and those objects can't (and shouldn't be) serialized to JSON.
c ó<—|xsi}|rOt|«|vr|t|«|«S|j«D]\} }
t|| «sŒ|
|«cS|�!t|ttf«s t|«}|�!t|ttf«s t|«}t|t
«r'|j
d||||||¬«} t| |||¬«Stj|«r;t|t«rJ‚tj|«} t| ||||||||¬« St|t«r |jSt|t«r t|«St|ttt td«f«r|St|t"«ryt|t«rªi} t|j%««}
|�|
t|«z}
|�|
t|«z}
|j«D]Z\}}|r"t|t«r|j'd«rŒ*|€|rŒ/||
vsŒ4t||||||¬«}t||||||¬«}|| |<Œ\| St|t(tt*t,t.t0f«r.g}|D]%}|j3t|||||||||¬« «Œ'|St|«t4vrt5t|«|«St6j«D]\}}t||«sŒ||«cSt9|«rt;d|›d �«‚ t |«}t|||||||||¬« S#t<$rX}g}|j3|« t?|«}n.#t<$r"}|j3|«tA|«|‚d}~wwxYwYd}~Œpd}~wwxYw)
aÊ
Convert any object to something that can be encoded in JSON.
This is used internally by FastAPI to make sure anything you return can be
encoded as JSON before it is sent to the client.
You can also use it yourself, for example to convert objects before saving them
in a database that supports only JSON.
Read more about it in the
[FastAPI docs for JSON Compatible Encoder](https://fastapi.tiangolo.com/tutorial/encoder/).
NÚjson)ÚmoderHrIrJrKrMrL)rMrLrO)rHrIrJrKrLrMrNrOÚ_sa)rJrKrMrNrOzOpydantic.v1 models are no longer supported by FastAPI. Please update the model Ú.)!ÚtyperBr0ÚsetÚdictrÚ
model_dumpÚjsonable_encoderÚ dataclassesÚ is_dataclassÚasdictrr;rÚstrr1r2r ÚkeysÚ
startswithÚlistÚ frozensetrrArÚappendr>rCr#rÚ ExceptionÚvarsÚ
ValueError)rGrHrIrJrKrLrMrNrOÚ encoder_typeÚencoder_instanceÚobj_dictÚ encoded_dictÚ allowed_keysÚkeyr;Ú encoded_keyÚ
encoded_valueÚ encoded_listÚitemrEÚ
classes_tupleÚdataÚeÚerrorss r*rYrYosÔ€ðL$Ò) r€NÙÜ �‹9˜Ñ &Ø,�>¤$ s£)Ñ,¨SÓ1Ð 1à2@×2FÑ2FÖ2HÑ.� Ð.ܘc <Õ0Ù+¨CÓ0Ò0ð3IðФ:¨g¼¼T°{Ô#CÜ�g“,ˆØÐ¤:¨g¼¼T°{Ô#CÜ�g“,ˆÜ�#”yÔ!Ø—>‘>ØØØØØ'Ø%Ø-ð"ó
ˆô Ø Ø%Ø-Ø+ô 
ð
ô ×Ñ Ô$ܘc¤4Ô(Ð(Ð(Ü×%Ñ% cÓ*ˆÜØ ØØØØ'Ø-Ø%Ø)Ø+ô

ð
ô�#”tÔØ�y‰yÐÜ�#”xÔ Ü�3‹xˆÜ�#œœS¤%¬¨d«Ð4Ô5؈
Ü�#Ô,Ô-ØÜ�#”tÔØˆ ܘ3Ÿ8™8›:“ˆ Ø Ð Ø œC ›LÑ (ˆLØ Ð Ø œC ›LÑ (ˆLØŸ)™)ž+‰JˆC�ñ(Ü& s¬CÔ0ØŸN™N¨5Õ1àÐ&ªlؘ<Ò'ä.ØØ%Ø"/Ø!-Ø#1Ø$3ô
� ô!1ØØ%Ø"/Ø!-Ø#1Ø$3ô