def METHOD_NAME(self):
    import parso
    from jedi import parser_utils
    from parso.python import tree
    locs = []
    def process_scope(scope):
        if isinstance(scope, tree.Function):
            # process all children after name node,
            # (otherwise name of global function will be marked as local def)
            local_names = set()
            global_names = set()
            for child in scope.children[2:]:
                process_node(child, local_names, global_names)
        else:
            if hasattr(scope, "subscopes"):
                for child in scope.subscopes:
                    process_scope(child)
            elif hasattr(scope, "children"):
                for child in scope.children:
                    process_scope(child)
    def process_node(node, local_names, global_names):
        if isinstance(node, tree.GlobalStmt):
            global_names.update([n.value for n in node.get_global_names()])
        elif isinstance(node, tree.Name):
            if node.value in global_names:
                return
            if node.is_definition():  # local def
                locs.append(node)
                local_names.add(node.value)
            elif node.value in local_names:  # use of local
                locs.append(node)
        elif isinstance(node, tree.BaseNode):
            # ref: jedi/parser/grammar*.txt
            if node.type == "trailer" and node.children[0].value == ".":
                # this is attribute
                return
            if isinstance(node, tree.Function):
                global_names = set()  # outer global statement doesn't have effect anymore
            for child in node.children:
                process_node(child, local_names, global_names)
    source = self.text.get("1.0", "end")
    module = parso.parse(source)
    for child in module.children:
        if isinstance(child, tree.BaseNode) and parser_utils.is_scope(child):
            process_scope(child)
    loc_pos = set(
        (
            "%d.%d" % (usage.start_pos[0], usage.start_pos[1]),
            "%d.%d" % (usage.start_pos[0], usage.start_pos[1] + len(usage.value)),
        )
        for usage in locs
    )
    return loc_pos