def pymel_name_completer(self, event):

    def get_children(obj):
        path, partialObj = splitDag(obj)
        #print "getting children", repr(path), repr(partialObj)

        try:
            fullpath = cmds.ls( path, l=1 )[0]
            if not fullpath: return []
            children = cmds.listRelatives( fullpath , f=1, c=1)
            if not children: return []
        except:
            return []

        matchStr = fullpath + '|' + partialObj
        #print "children", children
        #print matchStr, fullpath, path
        matches = [ x.replace( fullpath, path, 1) for x in children if x.startswith( matchStr ) ]
        #print matches
        return matches

    #print "\nnode", repr(event.symbol), repr(event.line)
    #print "\nbegin"
    line = event.symbol

    matches = None

    #--------------
    # Attributes
    #--------------
    m = re.match( r"""([a-zA-Z_0-9|:.]+)\.(\w*)$""", line)
    if m:
        node, attr = m.groups()
        if node == 'SCENE':
            res = cmds.ls( attr + '*' )
            if res:
                matches = ['SCENE.' + x for x in res if '|' not in x ]
        elif node.startswith('SCENE.'):
            node = node.replace('SCENE.', '')
            matches = ['SCENE.' + x for x in complete_node_with_attr(node, attr) if '|' not in x ]
        else:
            matches = complete_node_with_attr(node, attr)

    #--------------
    # Nodes
    #--------------

    else:
        # we don't yet have a full node
        if '|' not in line or (line.startswith('|') and line.count('|') == 1):
            #print "partial node"
            kwargs = {}
            if line.startswith('|'):
                kwargs['l'] = True
            matches = cmds.ls( expand(line), **kwargs )

        # we have a full node, get it's children
        else:
            matches = get_children(line)

    if not matches:
        raise IPython.ipapi.TryNext

    # if we have only one match, get the children as well
    if len(matches)==1:
        res = get_children(matches[0] + '|')
        matches += res
    return matches
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.3/pymel/tools/ipymel.py/pymel_name_completer/original