Shortcuts

Source code for ding.utils.loader.utils

from .base import Loader, ILoaderClass


[docs]def keep() -> ILoaderClass: """ Overview: Create a keep loader. """ return Loader(lambda v: v)
[docs]def raw(value) -> ILoaderClass: """ Overview: Create a raw loader. """ return Loader(lambda v: value)
[docs]def optional(loader) -> ILoaderClass: """ Overview: Create a optional loader. Arguments: - loader (:obj:`ILoaderClass`): The loader. """ return Loader(loader) | None
[docs]def check_only(loader) -> ILoaderClass: """ Overview: Create a check only loader. Arguments: - loader (:obj:`ILoaderClass`): The loader. """ return Loader(loader) & keep()
[docs]def check(loader) -> ILoaderClass: """ Overview: Create a check loader. Arguments: - loader (:obj:`ILoaderClass`): The loader. """ return Loader(lambda x: Loader(loader).check(x))