(host, defport=-1)
return host, defport
Split host and port, returning numeric port.
    Return given default port if no ':' found; defaults to -1.
    Return numerical port if a valid number are found after ':'.
    Return None if ':' but not a valid number.
Split host and port, returning numeric port.
    Return given default port if no ':' found; defaults to -1.
    Return numerical port if a valid number are found after ':'.
    Return None if ':' but not a valid number.
Split host and port returning numeric port . Return given default port if no : found ; defaults to - 1 . Return numerical port if a valid number are found after : . Return None if : but not a valid number .
def _splitnport(host, defport=-1):
    """Split host and port, returning numeric port.
    Return given default port if no ':' found; defaults to -1.
    Return numerical port if a valid number are found after ':'.
    Return None if ':' but not a valid number."""
    host, delim, port = host.rpartition(':')
    if not delim:
        host = port
    elif port:
        try:
            nport = int(port)
        except ValueError:
            nport = None
        return host, nport
    return host, defport
def _splitnport ( host , defport = - 1 ) : host , delim , port = host . rpartition ( ':' ) if not delim : host = port elif port : try : nport = int ( port ) except ValueError : nport = None return host , nport return host , defport