HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/Python311/Lib/site-packages/mysqlx/__pycache__/dbdoc.cpython-311.pyc
�

�nc���^�dZddlZddlmZGd�dej��ZGd�d��ZdS)	zImplementation of the DbDoc.�N�)�ProgrammingErrorc��eZdZdZd�ZdS)�ExprJSONEncoderzgA :class:`json.JSONEncoder` subclass, which enables encoding of
    :class:`mysqlx.ExprParser` objects.c�h�t|d��r|�Stj�||��S)N�expr)�hasattr�json�JSONEncoder�default)�self�os  �.D:\Python311\Lib\site-packages\mysqlx/dbdoc.pyrzExprJSONEncoder.default(s4���1�f���	��6�M���'�'��a�0�0�0�N)�__name__�
__module__�__qualname__�__doc__r�rrrr$s-������+�+�1�1�1�1�1rrc�J�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	dd	�Z
d
�Zd�ZdS)
�DbDocz�Represents a generic document in JSON format.

    Args:
        value (object): The value can be a JSON string or a dict.

    Raises:
        ValueError: If ``value`` type is not a basestring or dict.
    c���t|t��r	||_dSt|t��rt	j|��|_dSt
dt|�������)NzUnable to handle type: )�
isinstance�dict�__dict__�strr
�loads�
ValueError�type)r
�values  r�__init__zDbDoc.__init__9se���e�T�"�"�	F�!�D�M�M�M�
��s�
#�
#�	F� �J�u�-�-�D�M�M�M��D�t�E�{�{�D�D�E�E�Erc�*�|���S�N)�as_str�r
s r�__str__z
DbDoc.__str__As���{�{�}�}�rc�*�t|j��Sr#)�reprrr%s r�__repr__zDbDoc.__repr__Ds���D�M�"�"�"rc�D�|dkrtd���||j|<dS)N�_idzCannot modify _id)rr)r
�indexr s   r�__setitem__zDbDoc.__setitem__Gs/���E�>�	8�"�#6�7�7�7�$��
�e���rc��|j|Sr#�r)r
r,s  r�__getitem__zDbDoc.__getitem__Ls���}�U�#�#rc��||jvSr#r/)r
�items  r�__contains__zDbDoc.__contains__Os���t�}�$�$rNc�p�|j���}|r||d<nd|vr|d=t|��S)aeReturns a new copy of a :class:`mysqlx.DbDoc` object containing the
        `doc_id` provided. If `doc_id` is not provided, it will be removed from
        new :class:`mysqlx.DbDoc` object.

        Args:
            doc_id (Optional[str]): Document ID

        Returns:
            mysqlx.DbDoc: A new instance of DbDoc containing the _id provided
        r+)r�copyr)r
�doc_id�new_dicts   rr5z
DbDoc.copyRsJ���=�%�%�'�'���	 �$�H�U�O�O�
�h�
�	 �����X���rc�4�|j���S)zJReturns the keys.

        Returns:
            `list`: The keys.
        )r�keysr%s rr9z
DbDoc.keysds���}�!�!�#�#�#rc�B�tj|jt���S)z�Serialize :class:`mysqlx.DbDoc` to a JSON formatted ``str``.

        Returns:
            str: A JSON formatted ``str`` representation of the document.

        .. versionadded:: 8.0.16
        )�cls)r
�dumpsrrr%s rr$zDbDoc.as_strls���z�$�-�_�=�=�=�=rr#)
rrrrr!r&r)r-r0r3r5r9r$rrrrr/s���������F�F�F����#�#�#�%�%�%�
$�$�$�%�%�%�����$$�$�$�>�>�>�>�>rr)rr
�errorsrrrrrrr�<module>r>s���:#�"�����$�$�$�$�$�$�1�1�1�1�1�d�&�1�1�1�E>�E>�E>�E>�E>�E>�E>�E>�E>�E>r