diff options
Diffstat (limited to 'astroid/node_classes.py')
| -rw-r--r-- | astroid/node_classes.py | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/astroid/node_classes.py b/astroid/node_classes.py index 5adb1a03..b9af5983 100644 --- a/astroid/node_classes.py +++ b/astroid/node_classes.py @@ -579,33 +579,6 @@ class NodeNG: """ return self.parent.previous_sibling() - def nearest(self, nodes): - """Get the node closest to this one from the given list of nodes. - - :param nodes: The list of nodes to search. All of these nodes must - belong to the same module as this one. The list should be - sorted by the line number of the nodes, smallest first. - :type nodes: iterable(NodeNG) - - :returns: The node closest to this one in the source code, - or None if one could not be found. - :rtype: NodeNG or None - """ - myroot = self.root() - mylineno = self.fromlineno - nearest = None, 0 - for node in nodes: - assert node.root() is myroot, ( - "nodes %s and %s are not from the same module" % (self, node) - ) - lineno = node.fromlineno - if node.fromlineno > mylineno: - break - if lineno > nearest[1]: - nearest = node, lineno - # FIXME: raise an exception if nearest is None ? - return nearest[0] - # these are lazy because they're relatively expensive to compute for every # single node, and they rarely get looked at |
