def call_signatures(self): """ Return the function object of the call you're currently in. E.g. if the cursor is here:: abs(# <-- cursor is here This would return the ``abs`` function. On the other hand:: abs()# <-- cursor is here This would return an empty list.. :rtype: list of :class:`classes.CallSignature` """ call_signature_details = \ helpers.get_call_signature_details(self._get_module(), self._pos) if call_signature_details is None: return [] with common.scale_speed_settings(settings.scale_call_signatures): definitions = helpers.cache_call_signatures( self._evaluator, call_signature_details.bracket_leaf, self._code_lines, self._pos ) debug.speed('func_call followed') return [classes.CallSignature(self._evaluator, d.name, call_signature_details.bracket_leaf.start_pos, call_signature_details.call_index, call_signature_details.keyword_name_str) for d in definitions if hasattr(d, 'py__call__')]
def call_signatures(self): """ Return the function object of the call you're currently in. E.g. if the cursor is here:: abs(# <-- cursor is here This would return the ``abs`` function. On the other hand:: abs()# <-- cursor is here This would return ``None``. :rtype: list of :class:`classes.CallSignature` """ call_txt, call_index, key_name, start_pos = self._user_context.call_signature( ) if call_txt is None: return [] stmt = self._get_under_cursor_stmt(call_txt, start_pos) if stmt is None: return [] with common.scale_speed_settings(settings.scale_call_signatures): origins = cache.cache_call_signatures(self._evaluator, stmt, self.source, self._pos) debug.speed('func_call followed') return [ classes.CallSignature(self._evaluator, o.name, stmt, call_index, key_name) for o in origins if hasattr(o, 'py__call__') ]
def call_signatures(self): """ Return the function object of the call you're currently in. E.g. if the cursor is here:: abs(# <-- cursor is here This would return the ``abs`` function. On the other hand:: abs()# <-- cursor is here This would return an empty list.. :rtype: list of :class:`classes.CallSignature` """ call_details = helpers.get_call_signature_details( self._module_node, self._pos) if call_details is None: return [] context = self._evaluator.create_context(self._get_module(), call_details.bracket_leaf) definitions = helpers.cache_call_signatures(self._evaluator, context, call_details.bracket_leaf, self._code_lines, self._pos) debug.speed('func_call followed') # TODO here we use stubs instead of the actual contexts. We should use # the signatures from stubs, but the actual contexts, probably?! return [ classes.CallSignature(self._evaluator, signature, call_details) for signature in definitions.get_signatures() ]
def call_signatures(self): """ Return the function object of the call you're currently in. E.g. if the cursor is here:: abs(# <-- cursor is here This would return the ``abs`` function. On the other hand:: abs()# <-- cursor is here This would return ``None``. :rtype: list of :class:`classes.CallSignature` """ user_stmt = self._parser.user_stmt_with_whitespace() call, index = search_call_signatures(user_stmt, self._pos) if call is None: return [] with common.scale_speed_settings(settings.scale_call_signatures): _callable = lambda: self._evaluator.eval_call(call) origins = cache.cache_call_signatures(_callable, self.source, self._pos, user_stmt) origins = self._evaluator.eval_call(call) debug.speed('func_call followed') return [classes.CallSignature(self._evaluator, o, call, index) for o in origins if o.is_callable()]
def call_signatures(self): """ Return the function object of the call you're currently in. E.g. if the cursor is here:: abs(# <-- cursor is here This would return the ``abs`` function. On the other hand:: abs()# <-- cursor is here This would return ``None``. :rtype: list of :class:`classes.CallSignature` """ user_stmt = self._parser.user_stmt_with_whitespace() call, index = helpers.func_call_and_param_index(user_stmt, self._pos) if call is None: return [] with common.scale_speed_settings(settings.scale_call_signatures): _callable = lambda: self._evaluator.eval_call(call) origins = cache.cache_call_signatures(_callable, user_stmt) debug.speed('func_call followed') return [ classes.CallSignature(self._evaluator, o, call, index) for o in origins if o.isinstance(er.Function, er.Instance, er.Class) or isinstance(o, compiled.CompiledObject) and o.type() != 'module' ]
def call_signatures(self): """ Return the function object of the call you're currently in. E.g. if the cursor is here:: abs(# <-- cursor is here This would return the ``abs`` function. On the other hand:: abs()# <-- cursor is here This would return ``None``. :rtype: list of :class:`classes.CallSignature` """ user_stmt = self._parser.user_stmt_with_whitespace() call, index = search_call_signatures(user_stmt, self._pos) if call is None: return [] stmt_el = call while isinstance(stmt_el.parent, pr.StatementElement): # Go to parent literal/variable until not possible anymore. This # makes it possible to return the whole expression. stmt_el = stmt_el.parent # We can reset the execution since it's a new object # (fast_parent_copy). execution_arr, call.execution = call.execution, None with common.scale_speed_settings(settings.scale_call_signatures): _callable = lambda: self._evaluator.eval_call(stmt_el) origins = cache.cache_call_signatures(_callable, self.source, self._pos, user_stmt) debug.speed('func_call followed') key_name = None try: detail = execution_arr[index].assignment_details[0] except IndexError: pass else: try: key_name = unicode(detail[0][0].name) except (IndexError, AttributeError): pass return [ classes.CallSignature(self._evaluator, o, call, index, key_name) for o in origins if o.is_callable() ]