U nf @sddlmZddlZddlZddlZddlmZddlmZddl m Z m Z m Z ddl mZddlmZe speZGd d d eeZed dd dd ddejdddddddddddZeddd dd ddejdddddddddddZdS)) annotationsN)Enum)Path) TYPE_CHECKINGAnyCallable) deprecated)PydanticDeprecatedSince20c@seZdZdZdZdS)ProtocoljsonpickleN)__name__ __module__ __qualname__r r rrG/opt/hc_python/lib/python3.8/site-packages/pydantic/deprecated/parse.pyr sr `load_str_bytes` is deprecated.)categoryutf8F) content_typeencodingproto allow_pickle json_loadsz str | bytesz str | NonestrzProtocol | NoneboolzCallable[[str], Any]r)brrrrrreturncCstjdtdd|dkrL|rL|dr(n$|r>|dr>tj}ntd||pTtj}|tjkr|t|t rt| |}||S|tjkr|st dt|t r|n| }t |Std|dS) Nrr r stacklevel)r javascriptr zUnknown content-type: z4Trying to decode with pickle with allow_pickle=FalsezUnknown protocol: )warningswarnr endswithr r TypeErrorr isinstancebytesdecode RuntimeErrorencodeloads)rrrrrrZbbrrrload_str_bytess$         r,`load_file` is deprecated.z str | Path)pathrrrrrrcCs^tjdtddt|}|}|dkrJ|jdkr:tj}n|jdkrJtj}t ||||||dS)Nr-r r)z.jsz.jsonz.pkl)rrrrr) r"r#r r read_bytessuffixr r r r,)r.rrrrrrrrr load_file;s   r1) __future__rr r r"enumrpathlibrtypingrrrtyping_extensionsrr DeprecationWarningrr r+r,r1rrrrs2       !