How to use the yamale.util.to_unicode function in yamale

To help you get started, we’ve selected a few yamale 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 23andMe / Yamale / yamale / validators / validators.py View on Github external
def ip_address(self, value):
        try:
            import ipaddress
        except ImportError:
            raise ImportError("You must install the ipaddress backport in Py2")
        try:
            ipaddress.ip_interface(util.to_unicode(value))
        except ValueError:
            return False
        return True
github 23andMe / Yamale / yamale / validators / constraints.py View on Github external
def _is_valid(self, value):
        try:
            import ipaddress
        except ImportError:
            raise ImportError("You must install the ipaddress backport in Py2")
        try:
            ip = ipaddress.ip_interface(to_unicode(value))
        except ValueError:
            return False
        return self.version == ip.version