Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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