File size: 925 Bytes
079c32c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
from .base import Loader, ILoaderClass
def keep() -> ILoaderClass:
"""
Overview:
Create a keep loader.
"""
return Loader(lambda v: v)
def raw(value) -> ILoaderClass:
"""
Overview:
Create a raw loader.
"""
return Loader(lambda v: value)
def optional(loader) -> ILoaderClass:
"""
Overview:
Create a optional loader.
Arguments:
- loader (:obj:`ILoaderClass`): The loader.
"""
return Loader(loader) | None
def check_only(loader) -> ILoaderClass:
"""
Overview:
Create a check only loader.
Arguments:
- loader (:obj:`ILoaderClass`): The loader.
"""
return Loader(loader) & keep()
def check(loader) -> ILoaderClass:
"""
Overview:
Create a check loader.
Arguments:
- loader (:obj:`ILoaderClass`): The loader.
"""
return Loader(lambda x: Loader(loader).check(x))
|