def _get_bases_arguments(self): arglist = self.tree_node.get_super_arglist() if arglist: from jedi.evaluate import arguments return arguments.TreeArguments(self.evaluator, self.parent_context, arglist) return None
def eval_trailer(context, base_contexts, trailer): trailer_op, node = trailer.children[:2] if node == ')': # `arglist` is optional. node = None if trailer_op == '[': trailer_op, node, _ = trailer.children # TODO It's kind of stupid to cast this from a context set to a set. foo = set(base_contexts) # special case: PEP0484 typing module, see # https://github.com/davidhalter/jedi/issues/663 result = ContextSet() for typ in list(foo): if isinstance(typ, (ClassContext, TreeInstance)): typing_module_types = pep0484.py__getitem__(context, typ, node) if typing_module_types is not None: foo.remove(typ) result |= typing_module_types return result | base_contexts.get_item( eval_subscript_list(context.evaluator, context, node), ContextualizedNode(context, trailer)) else: debug.dbg('eval_trailer: %s in %s', trailer, base_contexts) if trailer_op == '.': return base_contexts.py__getattribute__(name_context=context, name_or_str=node) else: assert trailer_op == '(', 'trailer_op is actually %s' % trailer_op args = arguments.TreeArguments(context.evaluator, context, node, trailer) return base_contexts.execute(args)
def py__bases__(self): arglist = self.tree_node.get_super_arglist() if arglist: from jedi.evaluate import arguments args = arguments.TreeArguments(self.evaluator, self, arglist) return [value for key, value in args.unpack() if key is None] else: return [LazyKnownContext(compiled.create(self.evaluator, object))]
def find_additions(context, arglist, add_name): params = list(arguments.TreeArguments(context.evaluator, context, arglist).unpack()) result = set() if add_name in ['insert']: params = params[1:] if add_name in ['append', 'add', 'insert']: for key, whatever in params: result.add(whatever) elif add_name in ['extend', 'update']: for key, lazy_context in params: result |= set(lazy_context.infer().iterate()) return result
def py__bases__(self): arglist = self.tree_node.get_super_arglist() if arglist: from jedi.evaluate import arguments args = arguments.TreeArguments(self.evaluator, self.parent_context, arglist) lst = [value for key, value in args.unpack() if key is None] if lst: return lst if self.py__name__() == 'object' \ and self.parent_context == self.evaluator.builtins_module: return [] return [LazyKnownContexts( self.evaluator.builtins_module.py__getattribute__('object') )]
def eval_trailer(context, base_contexts, trailer): trailer_op, node = trailer.children[:2] if node == ')': # `arglist` is optional. node = None if trailer_op == '[': trailer_op, node, _ = trailer.children return base_contexts.get_item( eval_subscript_list(context.evaluator, context, node), ContextualizedNode(context, trailer)) else: debug.dbg('eval_trailer: %s in %s', trailer, base_contexts) if trailer_op == '.': return base_contexts.py__getattribute__(name_context=context, name_or_str=node) else: assert trailer_op == '(', 'trailer_op is actually %s' % trailer_op args = arguments.TreeArguments(context.evaluator, context, node, trailer) return base_contexts.execute(args)