How to use the environs.__init__.ParserConflictError 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
def add_parser(self, name: _StrType, func: typing.Callable) -> None:
        """Register a new parser method with the name ``name``. ``func`` must
        receive the input value for an environment variable.
        """
        if hasattr(self, name):
            raise ParserConflictError(
                "Env already has a method with name '{}'. Use a different name.".format(name)
            )
        self.__custom_parsers__[name] = _func2method(func, method_name=name)
        return None