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

All Samples(3)  |  Call(2)  |  Derive(0)  |  Import(1)
Return true iff 's' is made up only of characters that sometimes
appear in hostnames, and has a plausible arrangement of dots.

        def isPlausibleHostname(s):
    """Return true iff 's' is made up only of characters that sometimes
       appear in hostnames, and has a plausible arrangement of dots."""
    if not s:
        return 0
    if s.translate(_ALLCHARS, _HOST_CHARS):
        return 0
    if stringContains(s, "..") or s.startswith("."):
        return 0
    return 1
        


src/m/i/mixminion-HEAD/lib/mixminion/Config.py   mixminion(Download)
def _parseHost(host):
    """Validation function.  Checks a config value as a valid hostname.
       Raises ConfigError on failure."""
    host = host.strip()
    if not mixminion.Common.isPlausibleHostname(host):

src/m/i/mixminion-HEAD/lib/mixminion/Packet.py   mixminion(Download)
import zlib
from socket import inet_ntoa, inet_aton
from mixminion.Common import MixError, MixFatalError, encodeBase64, \
     floorDiv, formatBase64, formatTime, isSMTPMailbox, LOG, armorText, \
     unarmorText, isPlausibleHostname
        raise ParseError("Misformatted routing info")
    host = s[2+DIGEST_LEN:]
    if not isPlausibleHostname(host):
        raise ParseError("Nonsensical hostname")
    return MMTPHostInfo(s[2+DIGEST_LEN:], port, keyinfo)