Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

        def parseNodeAddress(address, port_opt=None):
    if address[:1] == '[':
        (host, port) = address[1:].split(']')
        if port[:1] == ':':
            port = port[1:]
        else:
            port = port_opt
    elif address.count(':') == 1:
        (host, port) = address.split(':')
    else:
        host = address
        port = port_opt
    # Resolve (maybe) and cast to cannonical form
    # XXX: Always pick the first result. This might not be what is desired, and
    # if so this function should either take a hint on the desired address type
    # or return either raw host & port or getaddrinfo return value.
    return socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM)[0][4][:2]
        


src/n/e/neoppod-1.1/neo/lib/config.py   neoppod(Download)
from ConfigParser import SafeConfigParser, NoOptionError
from . import util
from .util import parseNodeAddress
 
class ConfigurationManager(object):
    def getBind(self):
        """ Get the address to bind to """
        bind = self.__get('bind')
        return parseNodeAddress(bind, 0)