Did I find the right examples for you? yes no

All Samples(1)  |  Call(0)  |  Derive(0)  |  Import(1)
Convert an (host, port) tuple into a host:port string.
If one of the member is missing, the other is returned.

        def tuple_to_address(addr):
    """
    Convert an (host, port) tuple into a host:port string.
    If one of the member is missing, the other is returned.
    """
    host, port = addr
    if host and port:
        return "{}:{}".format(*addr)
    elif host and not port:
        return host
    elif port and not host:
        return port
    else:
        return None
        


src/w/s/wstunnel-0.0.3/wstunnel/test/test_toolbox.py   wstunnel(Download)
from wstunnel.factory import load_filter
from wstunnel.filters import DumpFilter
from wstunnel.toolbox import address_to_tuple, tuple_to_address, hex_dump, random_free_port
 
__author__ = 'fabio'