Exemplo n.º 1
0
 def __init__(self):
     self.cache_copy = {}
     self.cache_conv = {}
     self.nullobj = None
     BuiltinType.__init__(self)
     BuiltinCallable.__init__(self, self.TYPE_NAME, [], [ANY])
     return
Exemplo n.º 2
0
 def __init__(self):
   self.cache_copy = {}
   self.cache_conv = {}
   self.nullobj = None
   BuiltinType.__init__(self)
   BuiltinCallable.__init__(self, self.TYPE_NAME, [], [ANY])
   return
Exemplo n.º 3
0
 def __init__(self, name, args=None, optargs=None, expts=None):
     BuiltinCallable.__init__(self,
                              name,
                              args=args,
                              optargs=optargs,
                              expts=expts)
     BuiltinType.__init__(self)
     return
Exemplo n.º 4
0
 def __init__(self, name, bases):
   self.name = name
   self.bases = bases
   self.attrs = {}
   self.boundmethods = {}
   self.frames = set()
   BuiltinType.__init__(self)
   self.klasses = CompoundTypeNode(bases+[self])
   self.instance = InstanceObject(self)
   return
Exemplo n.º 5
0
    def __init__(self, parent_reporter, parent_frame, parent_space, anchor,
                 name, argnames, defaults, variargs, kwargs, tree):
        TreeReporter.__init__(self, parent_reporter)

        def maprec(func, x):
            if isinstance(x, tuple):
                return tuple(maprec(func, y) for y in x)
            else:
                return func(x)

        self.name = name
        # prepare local variables that hold passed arguments.
        self.space = Namespace(parent_space, name)
        self.frame = ExecutionFrame(None, tree)
        # handle "**kwd".
        self.kwarg = None
        if kwargs:
            self.kwarg = argnames[-1]
            del argnames[-1]
            self.space.register_var(self.kwarg)
        # handle "*args".
        self.variarg = None
        if variargs:
            self.variarg = argnames[-1]
            del argnames[-1]
            self.space.register_var(self.variarg)
        # handle normal args.
        self.argnames = tuple(argnames)
        maprec(lambda argname: self.space.register_var(argname), self.argnames)
        # build the function body.
        self.space.register_names(tree.code)
        self.body = self.FuncBody(name)
        self.body.set_retval(self.build_evals(tree.code))
        self.argvars = maprec(lambda argname: self.space[argname],
                              self.argnames)
        # assign the default values.
        self.defaults = tuple(defaults)
        for (var1, arg1) in zip(self.argvars[-len(defaults):], self.defaults):
            assign_arg(parent_frame, anchor, var1, arg1)
        self.frames = set()
        BuiltinType.__init__(self)
        return
Exemplo n.º 6
0
 def __init__(self, parent_reporter, parent_frame, parent_space, anchor,
              name, argnames, defaults, variargs, kwargs, tree):
   TreeReporter.__init__(self, parent_reporter)
   def maprec(func, x):
     if isinstance(x, tuple):
       return tuple( maprec(func, y) for y in x )
     else:
       return func(x)
   self.name = name
   # prepare local variables that hold passed arguments.
   self.space = Namespace(parent_space, name)
   self.frame = ExecutionFrame(None, tree)
   # handle "**kwd".
   self.kwarg = None
   if kwargs:
     self.kwarg = argnames[-1]
     del argnames[-1]
     self.space.register_var(self.kwarg)
   # handle "*args".
   self.variarg = None
   if variargs:
     self.variarg = argnames[-1]
     del argnames[-1]
     self.space.register_var(self.variarg)
   # handle normal args.
   self.argnames = tuple(argnames)
   maprec(lambda argname: self.space.register_var(argname), self.argnames)
   # build the function body.
   self.space.register_names(tree.code)
   self.body = self.FuncBody(name)
   self.body.set_retval(self.build_evals(tree.code))
   self.argvars = maprec(lambda argname: self.space[argname], self.argnames)
   # assign the default values.
   self.defaults = tuple(defaults)
   for (var1,arg1) in zip(self.argvars[-len(defaults):], self.defaults):
     assign_arg(parent_frame, anchor, var1, arg1)
   self.frames = set()
   BuiltinType.__init__(self)
   return
Exemplo n.º 7
0
 def __init__(self):
     BuiltinType.__init__(self)
     BuiltinCallable.__init__(self, self.TYPE_NAME, [ANY])
     return
Exemplo n.º 8
0
 def __init__(self):
     BuiltinType.__init__(self)
     BuiltinCallable.__init__(self, 'enumerate', [ANY])
     return
Exemplo n.º 9
0
 def __init__(self):
   BuiltinType.__init__(self)
   BuiltinCallable.__init__(self, self.TYPE_NAME, [ANY])
   return
Exemplo n.º 10
0
 def __init__(self):
   BuiltinType.__init__(self)
   BuiltinCallable.__init__(self, 'enumerate', [ANY])
   return
Exemplo n.º 11
0
 def __init__(self, name='staticmethod', wrapper=StaticMethodObject):
     self.wrapper = wrapper
     BuiltinType.__init__(self)
     BuiltinCallable.__init__(self, name, [ANY])
     return
Exemplo n.º 12
0
 def __init__(self, arg0, func):
   self.arg0 = arg0
   self.func = func
   BuiltinType.__init__(self)
   return
Exemplo n.º 13
0
 def __init__(self, klass, func):
   self.klass = klass
   self.func = func
   BuiltinType.__init__(self)
   return
Exemplo n.º 14
0
 def __init__(self, name='staticmethod', wrapper=StaticMethodObject):
   self.wrapper = wrapper
   BuiltinType.__init__(self)
   BuiltinCallable.__init__(self, name, [ANY])
   return
Exemplo n.º 15
0
 def __init__(self):
   BuiltinType.__init__(self)
   # type() funciton returns itself.
   BuiltinConstCallable.__init__(self, 'type', self, [ANY])
   return
Exemplo n.º 16
0
 def __init__(self, name, retobj, args=None, optargs=None, expts=None):
   BuiltinType.__init__(self)
   BuiltinConstCallable.__init__(self, name, retobj, args=args, optargs=optargs, expts=expts)
   return
Exemplo n.º 17
0
 def __init__(self):
     BuiltinType.__init__(self)
     # type() funciton returns itself.
     BuiltinConstCallable.__init__(self, 'type', self, [ANY])
     return