summaryrefslogtreecommitdiff
path: root/protocols.py
diff options
context:
space:
mode:
authorEmile Anclin <emile.anclin@logilab.fr>2009-09-03 10:42:12 +0200
committerEmile Anclin <emile.anclin@logilab.fr>2009-09-03 10:42:12 +0200
commit0421f6558f7acd1ff10f66249f443af1fc22a518 (patch)
tree22345914931495e7e72e102012a3d735d10fa67d /protocols.py
parent1ab963c638f896daf2a567be61aab4a7725c267f (diff)
downloadastroid-git-0421f6558f7acd1ff10f66249f443af1fc22a518.tar.gz
[R] demonkeypatch callable and infer_call_result methods
Diffstat (limited to 'protocols.py')
-rw-r--r--protocols.py39
1 files changed, 0 insertions, 39 deletions
diff --git a/protocols.py b/protocols.py
index 7ffe8c2a..ca2ff44d 100644
--- a/protocols.py
+++ b/protocols.py
@@ -331,45 +331,6 @@ nodes.Import.ass_type = end_ass_type
nodes.With.ass_type = end_ass_type
-# callable protocol ###########################################################
-
-
-def callable_true(self):
- return True
-nodes.Function.callable = callable_true
-nodes.Lambda.callable = callable_true
-nodes.Class.callable = callable_true
-
-
-def infer_call_result_function(self, caller, context=None):
- """infer what a function is returning when called"""
- if self.is_generator():
- yield Generator(self)
- return
- returns = self.nodes_of_class(nodes.Return, skip_klass=Function)
- for returnnode in returns:
- if returnnode.value is None:
- yield None
- else:
- try:
- for infered in returnnode.value.infer(context):
- yield infered
- except InferenceError:
- yield YES
-nodes.Function.infer_call_result = infer_call_result_function
-
-
-def infer_call_result_lambda(self, caller, context=None):
- """infer what a function is returning when called"""
- return self.body.infer(context)
-nodes.Lambda.infer_call_result = infer_call_result_lambda
-
-
-def infer_call_result_class(self, caller, context=None):
- """infer what a class is returning when called"""
- yield Instance(self)
-nodes.Class.infer_call_result = infer_call_result_class
-
# iteration protocol ##########################################################