Exemple #1
0
def _tuple_of_endpoints(value):
    if isinstance(value, tuple):
        return value
    elif isinstance(value, list):
        l = [endpoint(e) for e in value]
        return tuple(l)
    elif isinstance(value, str):
        list_of_str = value.split('\n')
        conv = []
        for s in list_of_str:
            conv.append(endpoint(s))
        return conv
    else:
        raise TypeError("Can't convert {0} to list of endpoints".format(value))
Exemple #2
0
def _tuple_of_endpoints(value):
    if isinstance(value, tuple):
        return value
    elif isinstance(value, list):
        l = [endpoint(e) for e in value]
        return tuple(l)
    elif isinstance(value, str):
        if value:
            list_of_str = value.split('\n')
            conv = []
            for s in list_of_str:
                conv.append(endpoint(s))
            return conv
        else:
            return []
    else:
        raise TypeError("Can't convert {0} to list of endpoints".format(value))