예제 #1
0
파일: node.py 프로젝트: eliadem/sakia
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))
예제 #2
0
파일: node.py 프로젝트: duniter/sakia
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))