zk_util.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:kingpin 作者: pinterest 项目源码 文件源码
def split_problematic_endpoints_line(line):
    """
    If the line of host contains more than one ":",
    for example: 10.99.184.69:900010.37.170.125:9006
    this splits the line and return a list of correct endpoints

    Args:
        ``line``: the problemtic line which contains more than one endpoint string.

    Returns:
        the splitted list of the problematic line which has correct endpoint strings.
    """

    colon_parts = line.strip().split(":")
    offset = len(colon_parts[-1])
    colon_positions = [m.start() for m in re.finditer(':', line)]
    start = 0
    split_parts = []
    for colon_position in colon_positions:
        end = colon_position + offset + 1
        split_part = line[start:end]
        split_parts.append(split_part)
        start = end
    return split_parts
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号