diff options
author | Bryce Guinta <bryce.paul.guinta@gmail.com> | 2018-03-18 21:32:43 -0600 |
---|---|---|
committer | Bryce Guinta <bryce.paul.guinta@gmail.com> | 2018-03-29 20:19:03 -0700 |
commit | fa82a17c61698847904fa7dea14414b30b80bdfc (patch) | |
tree | 2543c0b8d8e734a5f10fb015568273feac70361d /astroid/context.py | |
parent | 0dc364e60310ba9e609c42908af87053ff1d9d9f (diff) | |
download | astroid-git-fa82a17c61698847904fa7dea14414b30b80bdfc.tar.gz |
Update InferenceContext attribute documentation
Diffstat (limited to 'astroid/context.py')
-rw-r--r-- | astroid/context.py | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/astroid/context.py b/astroid/context.py index 838e2813..3e2e1f51 100644 --- a/astroid/context.py +++ b/astroid/context.py @@ -22,17 +22,43 @@ class InferenceContext(object): def __init__(self, path=None, inferred=None): self.path = path or set() - """Path of visited nodes and their lookupname - :type: set(tuple(NodeNG, optional(str)))""" + """ + :type: set(tuple(NodeNG, optional(str))) + + Path of visited nodes and their lookupname + + Currently this key is ``(node, context.lookupname)`` + """ self.lookupname = None + """ + :type: optional[str] + + The original name of the node + + e.g. + foo = 1 + The inference of 'foo' is nodes.Const(1) but the lookup name is 'foo' + """ self.callcontext = None + """ + :type: optional[CallContext] + + The call arguments and keywords for the given context + """ self.boundnode = None + """ + :type: optional[NodeNG] + + The bound node of the given context + + e.g. the bound node of object.__new__(cls) is the object node + """ self.inferred = inferred or {} """ :type: dict(seq, seq) Inferred node contexts to their mapped results - Currently the key is (node, lookupname, callcontext, boundnode) + Currently the key is ``(node, lookupname, callcontext, boundnode)`` and the value is tuple of the inferred results """ @@ -94,6 +120,10 @@ class CallContext(object): __slots__ = ('args', 'keywords') def __init__(self, args, keywords=None): + """ + :param List[NodeNG] args: Call positional arguments + :param Union[List[nodes.Keyword], None] keywords: Call keywords + """ self.args = args if keywords: keywords = [(arg.arg, arg.value) for arg in keywords] |