How to use the environs.__init__.PathField function in environs

To help you get started, we’ve selected a few environs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sloria / environs / environs / __init__.py View on Github external
class Env:
    """An environment variable reader."""

    __call__ = _field2method(ma.fields.Field, "__call__")  # type: ParserMethod

    int = _field2method(ma.fields.Int, "int")
    bool = _field2method(ma.fields.Bool, "bool")
    str = _field2method(ma.fields.Str, "str")
    float = _field2method(ma.fields.Float, "float")
    decimal = _field2method(ma.fields.Decimal, "decimal")
    list = _field2method(_make_list_field, "list", preprocess=_preprocess_list)
    dict = _field2method(ma.fields.Dict, "dict", preprocess=_preprocess_dict)
    json = _field2method(ma.fields.Field, "json", preprocess=_preprocess_json)
    datetime = _field2method(ma.fields.DateTime, "datetime")
    date = _field2method(ma.fields.Date, "date")
    path = _field2method(PathField, "path")
    log_level = _field2method(LogLevelField, "log_level")
    timedelta = _field2method(ma.fields.TimeDelta, "timedelta")
    uuid = _field2method(ma.fields.UUID, "uuid")
    url = _field2method(URLField, "url")
    dj_db_url = _func2method(_dj_db_url_parser, "dj_db_url")
    dj_email_url = _func2method(_dj_email_url_parser, "dj_email_url")
    dj_cache_url = _func2method(_dj_cache_url_parser, "dj_cache_url")

    def __init__(self, *, eager: _BoolType = True):
        self.eager = eager
        self._sealed = False  # type: bool
        self._fields = {}  # type: typing.Dict[_StrType, ma.fields.Field]
        self._values = {}  # type: typing.Dict[_StrType, typing.Any]
        self._errors = collections.defaultdict(list)  # type: ErrorMapping
        self._prefix = None  # type: typing.Optional[_StrType]
        self.__custom_parsers__ = {}  # type: typing.Dict[_StrType, ParserMethod]