HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/jsons/__pycache__/_load_impl.cpython-311.pyc
�

)�;f� ��:�dZddlZddlmZddlmZmZmZmZmZm	Z	ddl
mZddlm
Z
mZmZmZmZmZmZmZddlmZddlmZdd	lmZmZmZ	d!d
e
dd�ded
ee	ededeedeee egeffdefd�Z!dede"d
edefd�Z#		d"de d
ee	edeee efdefd�Z$			d#de%d
ee	ede deee efdef
d�Z&ded
edededeeee'ff
d�Z(ded
edefd�Z)ded
efd �Z*dS)$zt
PRIVATE MODULE: do not import (from) it directly.

This module contains functionality for loading stuff from json.
�N)�JSONDecodeError)�Optional�Dict�Callable�Tuple�Any�Type)�clear)�StateHolder�get_cls_from_str�get_class_name�get_cls_and_meta�determine_precedence�VALID_TYPES�T�can_match_with_none)�get_deserializer)�validate)�DeserializationError�
JsonsError�DecodeErrorF)�strict�	fork_inst�attr_getters�json_obj�clsrrr�returnc	��t||��t|||��rt|||��|St|t��rt|||��}|}t
||||�dd����\}}t||��}|�dd��}	d|i|�|||d||ud��}
t||||	fi|
��S)a�
    Deserialize the given ``json_obj`` to an object of type ``cls``. If the
    contents of ``json_obj`` do not match the interface of ``cls``, a
    DeserializationError is raised.

    If ``json_obj`` contains a value that belongs to a custom class, there must
    be a type hint present for that value in ``cls`` to let this function know
    what type it should deserialize that value to.


    **Example**:

    >>> from typing import List
    >>> import jsons
    >>> class Person:
    ...     # No type hint required for name
    ...     def __init__(self, name):
    ...         self.name = name
    >>> class Family:
    ...     # Person is a custom class, use a type hint
    ...         def __init__(self, persons: List[Person]):
    ...             self.persons = persons
    >>> loaded = jsons.load({'persons': [{'name': 'John'}]}, Family)
    >>> loaded.persons[0].name
    'John'

    If no ``cls`` is given, a dict is simply returned, but contained values
    (e.g. serialized ``datetime`` values) are still deserialized.

    If `strict` mode is off and the type of `json_obj` exactly matches `cls`
    then `json_obj` is simply returned.

    :param json_obj: the dict that is to be deserialized.
    :param cls: a matching class of which an instance should be returned.
    :param strict: a bool to determine if the deserializer should be strict
    (i.e. fail on a partially deserialized `json_obj` or on `None`).
    :param fork_inst: if given, it uses this fork of ``JsonSerializable``.
    :param attr_getters: a ``dict`` that may hold callables that return values
    for certain attributes.
    :param kwargs: the keyword args are passed on to the deserializer function.
    :return: an instance of ``cls`` if given, a dict otherwise.
    �
_inferred_clsF�_initialT�
meta_hints)rrrr r)
�_check_for_none�_should_skipr�
isinstance�strr�!_check_and_get_cls_and_meta_hints�getr�_do_load)rrrrr�kwargs�original_clsr!�deserializer�initial�kwargs_s           �C/opt/alt/python311/lib/python3.11/site-packages/jsons/_load_impl.py�loadr/s��d�H�c�"�"�"��H�c�6�*�*����3�	�*�*�*����#�s���9��s�H�i�8�8���L�7��#�y�&�*�*�_�e�"D�"D�F�F�O�C��$�C��3�3�L��j�j��T�*�*�G�	�j��
����$���L�0����G��H�l�C��D�D�G�D�D�D�r+r,c��t|d���}|�$td�|��||���	|||fi|��}t|||d��|rt	��|S#t
$rR}t	��t
|t��r�d�|||��}t|||��|�d}~wwxYw)NT��fully_qualifiedzNo deserializer for type "{}"rz.Could not deserialize value "{}" into "{}". {})r
r�formatrr
�	Exceptionr$r)	rr+rr,r)�cls_name�result�err�messages	         r.r(r(hs���
�c�4�8�8�8�H���"�#B�#I�#I�(�#S�#S�U]�_b�c�c�c�
���h��6�6�v�6�6�����f�[�1�2�2�2��	��G�G�G��
���D�D�D�
�����c�:�&�&�	��B�I�I�(�T\�^a�b�b��"�7�H�c�:�:��C�����D���s�!A,�,
C�6A
C�C�str_�jdkwargsc��|pi}	tj|fi|��}t||g|�Ri|��S#t$r}t	d|||��|�d}~wwxYw)ak
    Extend ``json.loads``, allowing a string to be loaded into a dict or a
    Python instance of type ``cls``. Any extra (keyword) arguments are passed
    on to ``json.loads``.

    :param str_: the string that is to be loaded.
    :param cls: a matching class of which an instance should be returned.
    :param jdkwargs: extra keyword arguments for ``json.loads`` (not
    ``jsons.loads``!)
    :param args: extra arguments for ``jsons.loads``.
    :param kwargs: extra keyword arguments for ``jsons.loads``.
    :return: a JSON-type object (dict, str, list, etc.) or an instance of type
    ``cls`` if given.
    z:Could not load a dict; the given string is not valid JSON.N)�json�loadsr/rr)r:rr;�argsr)�objr8s       r.r>r>�s���(�~�2�H�/��j��*�*��*�*��
�C��.�t�.�.�.�v�.�.�.��	�B�B�B��(�)-�s�C�9�9�>A�	B�����B���s�)�
A�A�A�utf-8�bytes_�encodingc���t|t��s1td�t	|����||���|pi}|�|���}t
||g|�Rd|i|��S)a�
    Extend ``json.loads``, allowing bytes to be loaded into a dict or a Python
    instance of type ``cls``. Any extra (keyword) arguments are passed on to
    ``json.loads``.

    :param bytes_: the bytes that are to be loaded.
    :param cls: a matching class of which an instance should be returned.
    :param encoding: the encoding that is used to transform from bytes.
    :param jdkwargs: extra keyword arguments for ``json.loads`` (not
    ``jsons.loads``!)
    :param args: extra arguments for ``jsons.loads``.
    :param kwargs: extra keyword arguments for ``jsons.loads``.
    :return: a JSON-type object (dict, str, list, etc.) or an instance of type
    ``cls`` if given.
    z(loadb accepts bytes only, "{}" was given)rCr;)r$�bytesrr4�type�decoder>)rBrrCr;r?r)r:s       r.�loadbrH�s���,�f�e�$�$�G�"�#M�$*�F�4��<�<�$8�$8�&�#�G�G�	G��~�2�H��=�=�(�=�+�+�D���s�?��?�?�?�X�?��?�?�?r0�inferred_clsc��t|��tvritt|��d���}d�tD��}d�|d�|����}t|||���t
||��\}}|r|�di��ni}	t||t|��|��|	fS)NTr2c�0�g|]}t|d�����S)Tr2)r
)�.0�typs  r.�
<listcomp>z5_check_and_get_cls_and_meta_hints.<locals>.<listcomp>�s5��/�/�/��&�c�4�@�@�@�/�/�/r0zIInvalid type: "{}", only arguments of the following types are allowed: {}z, �classes)	rFrr
r4�joinrrr'r)
rrrrI�invalid_type�valid_types�msg�
cls_from_meta�metar!s
          r.r&r&�s����H�~�~�[�(�(�%�d�8�n�n�d�K�K�K��/�/�"-�/�/�/���#�V�L�$�)�)�K�2H�2H�I�I�	�"�3��#�6�6�6�*�8�Y�?�?��M�4�,0�8����)�R�(�(�(�b�J���]�D��N�N�L�:�:�;E�F�Fr0c�@�|rt|��|kp|tuS�N)rFr)rrrs   r.r#r#�s#���J�0�4��>�>�S�0�?�S�C�Z�?r0c��|�Ct|��s6t|��}td�|��||����dSdS)Nz'NoneType cannot be deserialized into {})r9�source�target)rr
rr4)rrr6s   r.r"r"�s_���� 3�C� 8� 8��!�#�&�&��"�=�D�D�X�N�N������	����r0rW)NN)NrAN)+�__doc__r=r�typingrrrrrr	�jsons._cacher
�jsons._common_implrrr
rrrrr�jsons._lizers_implr�jsons._validationr�jsons.exceptionsrrr�object�boolrFr%r/�callabler(r>rErH�dictr&r#r"�r0r.�<module>rgs{����
���� � � � � � �=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�=�������	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�0�/�/�/�/�/�&�&�&�&�&�&�J�J�J�J�J�J�J�J�J�J�
"&�KE��$/�BF�
KE�KE�KE��KE�
�d�1�g�
�KE��	KE�
�D�>�KE��t�C��"�f�*�)=�$=�>�?�
KE��KE�KE�KE�KE�\�v��#���������4"&�04�/�/��/�
�d�1�g�
�/��4��V��,�-�/�
�/�/�/�/�@"&��04�	@�@��@�
�d�1�g�
�@��@��4��V��,�-�	@��
@�@�@�@�<F��F�
�F��F��	F� %�T�8�D�>�%9�:�	F�F�F�F�(@�6�@��@�d�@�@�@�@��f��4������r0