summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2016-01-25 00:11:33 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2016-01-25 00:11:33 +0200
commiteb48cf362e413e29c0ddaa7c7d0c88a7db0be95a (patch)
tree7f40f39e16ac6625106d3f2c975fe9ee8ab81eb0
parent72eeb62f5fe54b646cd7f733ed3c62e8fc12327c (diff)
downloadastroid-git-eb48cf362e413e29c0ddaa7c7d0c88a7db0be95a.tar.gz
NodeNG.nearest was removed.
-rw-r--r--ChangeLog3
-rw-r--r--astroid/tree/base.py18
2 files changed, 3 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 3836022a..251986c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@ Change log for the astroid package (used to be astng)
--
+ * NodeNG.nearest was removed. It's not an API that we were using
+ and it was buggy.
+
* Dict nodes are constructed with two arguments, keys and values,
in the same way that ast.Dict is built.
diff --git a/astroid/tree/base.py b/astroid/tree/base.py
index 43f77d12..755e3b8b 100644
--- a/astroid/tree/base.py
+++ b/astroid/tree/base.py
@@ -226,24 +226,6 @@ class NodeNG(object):
"""return the previous sibling statement"""
return self.parent.previous_sibling()
- def nearest(self, nodes):
- """return the node which is the nearest before this one in the
- given list of nodes
- """
- 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