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__/_dump_impl.cpython-311.pyc
�

)�;f���dZddlZddlmZmZddlmZddlmZddl	m
Z
ddlmZddl
mZ	dd	ed
�dedeed
edeedef
d�Zd�Z	ddedeeeefdefd�Z		ddededeeeefdefd�ZdS)zr
PRIVATE MODULE: do not import (from) it directly.

This module contains functionality for dumping stuff to json.
�N)�Optional�Dict)�clear)�StateHolder)�announce_class)�get_serializer)�SerializationErrorF)�strict�	fork_inst�obj�clsr
r�returnc��|p|j}t||��}|�dd��}|d|d�|�}t||���t	|||||��S)a�
    Serialize the given ``obj`` to a JSON equivalent type (e.g. dict, list,
    int, ...).

    The way objects are serialized can be finetuned by setting serializer
    functions for the specific type using ``set_serializer``.

    You can also provide ``cls`` to specify that ``obj`` needs to be serialized
    as if it was of type ``cls`` (meaning to only take into account attributes
    from ``cls``). The type ``cls`` must have a ``__slots__`` defined. Any type
    will do, but in most cases you may want ``cls`` to be a base class of
    ``obj``.
    :param obj: a Python instance of any sort.
    :param cls: if given, ``obj`` will be dumped as if it is of type ``type``.
    :param strict: a bool to determine if the serializer should be strict
    (i.e. only dumping stuff that is known to ``cls``).
    :param fork_inst: if given, it uses this fork of ``JsonSerializable``.
    :param kwargs: the keyword args are passed on to the serializer function.
    :return: the serialized obj as a JSON type.
    �_initialTF)rrr
)r)�	__class__r�getr�_do_dump)	rr
r
r�kwargs�cls_�
serializer�initial�kwargs_s	         �C/opt/alt/python311/lib/python3.11/site-packages/jsons/_dump_impl.py�dumprs���4��#�-�D���i�0�0�J��j�j��T�*�*�G�������	�G��4�9�-�-�-�-��C��S�'�7�;�;�;�c��	||fd|i|��}|rt��|S#t$r0}t��tt|����|�d}~wwxYw)Nr
)r�	Exceptionr	�str)rrr
rr�result�errs       rrr:sw��4���C�3�3�S�3�F�3�3���	��G�G�G��
���4�4�4�
���� ��S���*�*��3�����4���s��
A�+A�A�jdkwargsc�N�|pi}t|g|�Ri|��}tj|fi|��S)a
    Extend ``json.dumps``, allowing any Python instance to be dumped to a
    string. Any extra (keyword) arguments are passed on to ``json.dumps``.

    :param obj: the object that is to be dumped to a string.
    :param jdkwargs: extra keyword arguments for ``json.dumps`` (not
    ``jsons.dumps``!)
    :param args: extra arguments for ``jsons.dumps``.
    :param kwargs: Keyword arguments that are passed on through the
    serialization process.
    passed on to the serializer function.
    :return: ``obj`` as a ``str``.
    )r�json�dumps)rr!�argsr�dumpeds     rr$r$EsB��"�~�2�H�
�#�
'��
'�
'�
'��
'�
'�F��:�f�)�)��)�)�)r�utf-8�encodingc�z�|pi}t|g|�Ri|��}tj|fi|��}|�|���S)aU
    Extend ``json.dumps``, allowing any Python instance to be dumped to bytes.
    Any extra (keyword) arguments are passed on to ``json.dumps``.

    :param obj: the object that is to be dumped to bytes.
    :param encoding: the encoding that is used to transform to bytes.
    :param jdkwargs: extra keyword arguments for ``json.dumps`` (not
    ``jsons.dumps``!)
    :param args: extra arguments for ``jsons.dumps``.
    :param kwargs: Keyword arguments that are passed on through the
    serialization process.
    passed on to the serializer function.
    :return: ``obj`` as ``bytes``.
    )r()rr#r$�encode)rr(r!r%r�dumped_dict�
dumped_strs       r�dumpbr-[sX��&�~�2�H��s�,�T�,�,�,�V�,�,�K���K�4�4�8�4�4�J����h��/�/�/r)N)r'N)�__doc__r#�typingrr�jsons._cacher�jsons._common_implr�jsons._extra_implr�jsons._lizers_implr�jsons.exceptionsr	�object�type�boolrrrr$�bytesr-�rr�<module>r:s�����
����!�!�!�!�!�!�!�!�������*�*�*�*�*�*�,�,�,�,�,�,�-�-�-�-�-�-�/�/�/�/�/�/� $�'<��%0�	'<�'<�'<�f�'<��t�n�'<��'<��T�N�	'<�
�'<�'<�'<�'<�T4�4�4�37�*�*�v�*��T�#�v�+�.�/�*��*�*�*�*�."�26�0�0�v�0��0��T�#�v�+�.�/�0��	0�0�0�0�0�0r