Exemplo n.º 1
0
def inherit_tag_str(node_tag, other_tag, strip_marker=False):
    '''Gives _node_ the tag that _other_ has, unless _node_ already has one, or _other_ doesn't.'''
    if strip_marker: return base_tag(node_tag, strip_cptb_tag=False)

    if other_tag.rfind('-') != -1 and node_tag.rfind(':') == -1:
        return node_tag + other_tag[other_tag.rfind('-'):]
    elif other_tag.rfind(':') != -1 and node_tag.rfind(':') == -1:
        return node_tag + other_tag[other_tag.rfind(':'):]
    return node_tag
Exemplo n.º 2
0
def inherit_tag_str(node_tag, other_tag, strip_marker=False):
    '''Gives _node_ the tag that _other_ has, unless _node_ already has one, or _other_ doesn't.'''
    if strip_marker: return base_tag(node_tag, strip_cptb_tag=False)
    
    if other_tag.rfind('-') != -1 and node_tag.rfind(':') == -1:
        return node_tag + other_tag[other_tag.rfind('-'):]
    elif other_tag.rfind(':') != -1 and node_tag.rfind(':') == -1:
        return node_tag + other_tag[other_tag.rfind(':'):]
    return node_tag
Exemplo n.º 3
0
def inherit_tag(node, other, strip_marker=False):
    # node = IP:h other = CP-APP:a
    # node = IP:h-APP:a
    '''Gives _node_ the tag that _other_ has, unless _node_ already has one, or _other_ doesn't.'''
    if strip_marker: node.tag = base_tag(node.tag, strip_cptb_tag=False)

    if other.tag.rfind('-') != -1 and node.tag.rfind('-') == -1:
        node.tag += other.tag[other.tag.rfind('-'):]
    elif other.tag.rfind(':') != -1 and node.tag.rfind(':') == -1:
        node.tag += other.tag[other.tag.rfind(':'):]
Exemplo n.º 4
0
def inherit_tag(node, other, strip_marker=False):
    # node = IP:h other = CP-APP:a
    # node = IP:h-APP:a
    '''Gives _node_ the tag that _other_ has, unless _node_ already has one, or _other_ doesn't.'''
    if strip_marker: node.tag = base_tag(node.tag, strip_cptb_tag=False)

    if other.tag.rfind('-') != -1 and node.tag.rfind('-') == -1:
        node.tag += other.tag[other.tag.rfind('-'):]    
    elif other.tag.rfind(':') != -1 and node.tag.rfind(':') == -1:
        node.tag += other.tag[other.tag.rfind(':'):]