Did I find the right examples for you? yes no

All Samples(6)  |  Call(3)  |  Derive(0)  |  Import(3)

        def import_file(filename, name = None, package = None, add_to_sys_modules = False):
    if os.path.isdir(filename):
        filename = os.path.join(filename, "__init__.py")
    if name is None:
        name = os.path.basename(filename).split(".")[0]
        dirname = os.path.basename(os.path.dirname(filename)).strip()
        if name == "__init__" and dirname:
            name = dirname
        elif package is not None:
            name = package + "." + name
    mod = ModuleType(name)
    mod.__file__ = os.path.abspath(filename)
    if package is not None:
        mod.__package__ = package
        mod.__path__ = [os.path.dirname(mod.__file__)]
    if add_to_sys_modules:
        sys.modules[name] = mod
    execfile(filename, mod.__dict__)
    return mod
        


src/a/g/agnos-HEAD/libagnos/python/src/agnos/restful/server.py   agnos(Download)
from .xmlser import dumps as dump_xml, loads as load_xml
from .jsonser import dumps as dump_json, loads_root as load_json
from .util import import_file
 
 
    def connect_executable(cls, bindings_module, executable, args = []):
        if isinstance(bindings_module, str):
            bindings_module = import_file(bindings_module)
        client = bindings_module.Client.connect_executable(executable, args)
        return cls(bindings_module, client)

src/a/g/agnos-1.0.2/src/agnos/restful/server.py   agnos(Download)
from .xmlser import dumps as dump_xml, loads as load_xml
from .jsonser import dumps as dump_json, loads_root as load_json
from .util import import_file
 
 
    def connect_executable(cls, bindings_module, executable, args = []):
        if isinstance(bindings_module, str):
            bindings_module = import_file(bindings_module)
        client = bindings_module.Client.connect_executable(executable, args)
        return cls(bindings_module, client)

src/l/i/libagnos-1.0.1/src/agnos/restful/server.py   libagnos(Download)
from .xmlser import dumps as dump_xml, loads as load_xml
from .jsonser import dumps as dump_json, loads_root as load_json
from .util import import_file
 
 
    def connect_executable(cls, bindings_module, executable, args = []):
        if isinstance(bindings_module, str):
            bindings_module = import_file(bindings_module)
        client = bindings_module.Client.connect_executable(executable, args)
        return cls(bindings_module, client)