def get_signatures(self): # Since calling staticmethod without a function is illegal, the Jedi # plugin doesn't return anything. Therefore call directly and get what # we want: An instance of staticmethod. args = ValuesArguments([]) init_funcs = self.py__call__(args).py__getattribute__('__init__') return [sig.bind(self) for sig in init_funcs.get_signatures()]
def get_filters(self, origin_scope=None, is_instance=False, include_metaclasses=True): if include_metaclasses: metaclasses = self.get_metaclasses() if metaclasses: for f in self.get_metaclass_filters(metaclasses): yield f for cls in self.py__mro__(): if cls.is_compiled(): for filter in cls.get_filters(is_instance=is_instance): yield filter else: yield ClassFilter( self, node_context=cls.as_context(), origin_scope=origin_scope, is_instance=is_instance ) if not is_instance: from jedi.inference.compiled import builtin_from_name type_ = builtin_from_name(self.inference_state, u'type') assert isinstance(type_, ClassValue) if type_ != self: # We are not using execute_with_values here, because the # plugin function for type would get executed instead of an # instance creation. args = ValuesArguments([]) for instance in type_.py__call__(args): instance_filters = instance.get_filters() # Filter out self filters next(instance_filters, None) next(instance_filters, None) x = next(instance_filters, None) assert x is not None yield x
def py__call__(self, arguments=None): from jedi.inference.value import TreeInstance if arguments is None: arguments = ValuesArguments([]) return ValueSet([ TreeInstance(self.inference_state, self.parent_context, self, arguments) ])
def py__getitem__(self, index_value_set, contextualized_node): names = self.get_function_slot_names(u'__getitem__') if not names: return super(AbstractInstanceValue, self).py__getitem__( index_value_set, contextualized_node, ) args = ValuesArguments([index_value_set]) return ValueSet.from_sets(name.infer().execute(args) for name in names)
def execute_with_values(self, *value_list): from jedi.inference.arguments import ValuesArguments arguments = ValuesArguments( [ValueSet([value]) for value in value_list]) return self.inference_state.execute(self, arguments)