Did I find the right examples for you? yes no

All Samples(5)  |  Call(3)  |  Derive(0)  |  Import(2)

        def parse_address(netloc, default_port=8000):
    if netloc.startswith("unix:"):
        return netloc.split("unix:")[1]

    if netloc.startswith("unix://"):
        return netloc.split("unix://")[1]

    if netloc.startswith("tcp://"):
        netloc = netloc.split("tcp://")[1]


    # get host
    if '[' in netloc and ']' in netloc:
        host = netloc.split(']')[0][1:].lower()
    elif ':' in netloc:
        host = netloc.split(':')[0].lower()
    elif netloc == "":
        host = "0.0.0.0"
    else:
        host = netloc.lower()

    #get port
    netloc = netloc.split(']')[-1]
    if ":" in netloc:
        port = netloc.split(':', 1)[1]
        if not port.isdigit():
            raise RuntimeError("%r is not a valid port number." % port)
        port = int(port)
    else:
        port = default_port
    return (host, port)
        


src/g/r/GRunner-0.3.4/grunner/runner.py   GRunner(Download)
 
 
        self.address = util.parse_address(bind)
        self.num_workers = num_workers
        self.daemon = daemon

src/t/p/tproxy-0.5.4/tproxy/client.py   tproxy(Download)
 
from .server import ServerConnection, InactivityTimeout
from .util import parse_address, is_ipv6
from .sendfile import async_sendfile
 
 
        if 'remote' in commands:
            remote = parse_address(commands['remote'])
            if 'data' in commands:
                self.buf = [commands['data']]

src/t/p/tproxy-HEAD/tproxy/client.py   tproxy(Download)
 
from .server import ServerConnection, InactivityTimeout
from .util import parse_address, is_ipv6
from .sendfile import async_sendfile
 
 
        if 'remote' in commands:
            remote = parse_address(commands['remote'])
            if 'data' in commands:
                self.buf = [commands['data']]