@@ -0,0 +1,1631 @@
+import new%0A%0Adef importString(source, filename, globals_=None, locals_=None):%0A    %22%22%22construct a module from source code.%0A    %0A    The module will I%7Bnot%7D appear in L%7Bsys.modules%7D.%0A    %0A    @arg source: source code of the module%0A    @type source: string%0A    %0A    @arg filename: a filename to use for the module's __file__%0A    @type filename: string%0A    %0A    @arg globals_: globals to pass to L%7Beval%7D(). Defaults to globals()%0A    @type globals_: dict%0A%0A    @arg locals_: locals to pass to L%7Beval%7D(). Defaults to empty dict%0A    @type locals_: dict    %0A    %0A    @rtype: a module%0A    %22%22%22%0A    if globals_ is None: globals_ = globals()%0A    if locals_ is None: locals_ = %7B%7D%0A    locals_%5B'__file__'%5D = filename%0A    co = compile(source, filename, 'exec')%0A    eval(co, globals_, locals_)%0A    mod = new.module(os.path.splitext(os.path.basename(filename))%5B0%5D)%0A    mod.__dict__.update(locals_)%0A    return mod%0A%0Adef importFile(f, filename=None, globals_=None, locals_=None):%0A    %22%22%22construct a module from a file%0A    %0A    The module will I%7Bnot%7D appear in L%7Bsys.modules%7D.  The key difference between this function and __import__ is that the file need not be present in L%7Bsys.path%7D.%0A    %0A    @arg f: filename or open file%0A    @type f: string or L%7Bfile%7D%0A    %0A    @arg globals_: globals to pass to L%7Beval%7D(). Defaults to globals()%0A    @type globals_: dict%0A%0A    @arg locals_: locals to pass to L%7Beval%7D(). Defaults to empty dict%0A    @type locals_: dict    %0A    %0A    @rtype: a module%0A    %22%22%22%0A    if isinstance(f, str):%0A        f = file(f, 'r')%0A    if filename is None:%0A        filename = f.name%0A    return importString(f.read(), filename, globals_, locals_)

add some utils from GK