OXIESEC PANEL
- Current Dir:
/
/
opt
/
alt
/
python37
/
lib
/
python3.7
/
site-packages
/
jsons
/
serializers
Server IP: 2a02:4780:11:1084:0:327f:3464:10
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/16/2023 12:57:19 PM
rwxr-xr-x
📄
__init__.py
189 bytes
03/16/2023 12:57:19 PM
rw-r--r--
📁
__pycache__
-
03/16/2023 12:57:19 PM
rwxr-xr-x
📄
default_complex.py
244 bytes
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_date.py
593 bytes
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_datetime.py
909 bytes
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_decimal.py
294 bytes
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_dict.py
3.22 KB
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_enum.py
612 bytes
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_iterable.py
2.82 KB
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_list.py
1.53 KB
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_object.py
13.03 KB
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_path.py
540 bytes
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_primitive.py
1.06 KB
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_time.py
487 bytes
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_timedelta.py
379 bytes
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_timezone.py
524 bytes
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_tuple.py
1.48 KB
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_union.py
1.45 KB
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_uuid.py
393 bytes
03/16/2023 12:57:19 PM
rw-r--r--
📄
default_zone_info.py
365 bytes
03/16/2023 12:57:19 PM
rw-r--r--
Editing: default_list.py
Close
from typing import Optional from typish import get_args from jsons import get_serializer from jsons._common_impl import StateHolder from jsons._dump_impl import dump def default_list_serializer( obj: list, cls: type = None, *, strict: bool = False, fork_inst: Optional[type] = StateHolder, **kwargs) -> list: """ Serialize the given ``obj`` to a list of serialized objects. :param obj: the list that is to be serialized. :param cls: the (subscripted) type of the list. :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: any keyword arguments that may be given to the serialization process. :return: a list of which all elements are serialized. """ if not obj: return [] kwargs_ = {**kwargs, 'strict': strict} # The meta kwarg store_cls is filtered out, because an iterable should have # its own -meta attribute. kwargs_.pop('_store_cls', None) inner_type = None serializer = dump cls_args = get_args(cls) if cls_args: inner_type = cls_args[0] serializer = get_serializer(inner_type, fork_inst) elif strict: inner_type = type(obj[0]) serializer = get_serializer(inner_type, fork_inst) return [serializer(elem, cls=inner_type, fork_inst=fork_inst, **kwargs_) for elem in obj]