summaryrefslogtreecommitdiff
path: root/protocols.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2014-10-20 17:41:05 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2014-10-20 17:41:05 +0300
commit2e2d04b4c270f31c1a9883e9ae41bb2d4cbca3fe (patch)
tree0be6f15bf00f1a276418ca292cad029d53ebd35b /protocols.py
parent1ed485519d63e3fa9cd87cf336f39445d3488396 (diff)
parent3a090e2819c85abacae5dd244733408cb110e427 (diff)
downloadastroid-git-2e2d04b4c270f31c1a9883e9ae41bb2d4cbca3fe.tar.gz
Various speed improvements.
Patch by Alex Munroe.
Diffstat (limited to 'protocols.py')
-rw-r--r--protocols.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/protocols.py b/protocols.py
index e7703a06..cc284285 100644
--- a/protocols.py
+++ b/protocols.py
@@ -23,7 +23,7 @@ __doctype__ = "restructuredtext en"
from astroid.exceptions import InferenceError, NoDefault, NotFoundError
from astroid.node_classes import unpack_infer
-from astroid.bases import copy_context, \
+from astroid.bases import InferenceContext, \
raise_if_nothing_infered, yes_if_nothing_infered, Instance, YES
from astroid.nodes import const_factory
from astroid import nodes
@@ -282,7 +282,8 @@ def _arguments_infer_argname(self, name, context):
# if there is a default value, yield it. And then yield YES to reflect
# we can't guess given argument value
try:
- context = copy_context(context)
+ if context is None:
+ context = InferenceContext()
for infered in self.default_value(name).infer(context):
yield infered
yield YES
@@ -294,13 +295,8 @@ def arguments_assigned_stmts(self, node, context, asspath=None):
if context.callcontext:
# reset call context/name
callcontext = context.callcontext
- context = copy_context(context)
- context.callcontext = None
- for infered in callcontext.infer_argument(self.parent, node.name, context):
- yield infered
- return
- for infered in _arguments_infer_argname(self, node.name, context):
- yield infered
+ return callcontext.infer_argument(self.parent, node.name, context)
+ return _arguments_infer_argname(self, node.name, context)
nodes.Arguments.assigned_stmts = arguments_assigned_stmts