Completed
Push — master ( 919d86...33db6d )
by Ramon
23s queued 10s
created

jsons.serializers.default_path   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 4
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A default_path_serializer() 0 12 1
1
from pathlib import PurePath
2
3
4
def default_path_serializer(obj: PurePath, **kwargs) -> str:
5
    """
6
    Serialize a ``pathlib.PurePath`` object to a ``str``, Posix-style.
7
8
    Posix-style strings are used as they can be used to create ``pathlib.Path``
9
    objects on both Posix and Windows systems, but Windows-style strings can
10
    only be used to create valid ``pathlib.Path`` objects on Windows.
11
    :param obj: the path to serialize.
12
    :param kwargs: not used.
13
    :return: a ``str``.
14
    """
15
    return obj.as_posix()
16