예제 #1
0
파일: mixedmodule.py 프로젝트: bukzor/pypy
    def init(self, space):
        """This is called each time the module is imported or reloaded
        """
        if self.w_initialdict is not None:
            # the module was already imported.  Refresh its content with
            # the saved dict, as done with built-in and extension modules
            # on CPython.
            space.call_method(self.w_dict, 'update', self.w_initialdict)

        for w_submodule in self.submodules_w:
            name = space.str0_w(w_submodule.w_name)
            space.setitem(self.w_dict, space.wrap(name.split(".")[-1]), w_submodule)
            space.getbuiltinmodule(name)

        if self.w_initialdict is None:
            Module.init(self, space)
            if not self.lazy and self.w_initialdict is None:
                self.w_initialdict = space.call_method(self.w_dict, 'items')
예제 #2
0
파일: mixedmodule.py 프로젝트: Qointum/pypy
    def init(self, space):
        """This is called each time the module is imported or reloaded
        """
        if self.w_initialdict is not None:
            # the module was already imported.  Refresh its content with
            # the saved dict, as done with built-in and extension modules
            # on CPython.
            space.call_method(self.w_dict, 'update', self.w_initialdict)

        for w_submodule in self.submodules_w:
            name = space.str0_w(w_submodule.w_name)
            space.setitem(self.w_dict, space.wrap(name.split(".")[-1]), w_submodule)
            space.getbuiltinmodule(name)

        if self.w_initialdict is None:
            Module.init(self, space)
            if not self.lazy and self.w_initialdict is None:
                self.save_module_content_for_future_reload()
예제 #3
0
 def init(self, space):
     """This is called each time the module is imported or reloaded
     """
     if self.w_initialdict is not None:
         space.call_method(self.w_dict, 'update', self.w_initialdict)
     Module.init(self, space)