Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(0)  |  Derive(0)  |  Import(1)
Check whether *pattern* could be/match an IP address.

Does *not* guarantee that pattern is in fact a valid IP address; especially
the checks for IPv6 are rather coarse.  This function is for security
checks, not for validating IP addresses.

:param pattern: A pattern for a host name.
:type pattern: `bytes` or `unicode`

:return: `True` if *pattern* could be an IP address, else `False`.(more...)

        def _is_ip_address(pattern):
    """
    Check whether *pattern* could be/match an IP address.

    Does *not* guarantee that pattern is in fact a valid IP address; especially
    the checks for IPv6 are rather coarse.  This function is for security
    checks, not for validating IP addresses.

    :param pattern: A pattern for a host name.
    :type pattern: `bytes` or `unicode`

    :return: `True` if *pattern* could be an IP address, else `False`.
    :rtype: `bool`
    """
    if isinstance(pattern, text_type):
        try:
            pattern = pattern.encode('ascii')
        except UnicodeError:
            return False

    return (
        _RE_IPv4.match(pattern) is not None
        or _RE_IPv6.match(pattern) is not None
        or _RE_NUMBER.match(pattern) is not None
    )
        


src/s/e/service_identity-0.2/tests/test_common.py   service_identity(Download)
import service_identity._common
 
from service_identity._common import (
    CertificateError,
    DNSMismatchError,