Did I find the right examples for you? yes no      Crawl my project      Python Jobs

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

        def getObject(module, name, reload=0,
              # The use of a mutable default is intentional here,
              # because modules is a module cache.
    # The use of modules here is not thread safe, however, there is
    # no real harm in a race condition here.  If two threads
    # update the cache, then one will have simply worked a little
    # harder than need be.  So, in this case, we won't incur
    # the expense of a lock.
    old = modules.get(module)
    if old is not None and name in old and not reload:
        return old[name]

    base, ext = os.path.splitext(module)
    if ext in ('py', 'pyc'):
        # XXX should never happen; splitext() keeps '.' with the extension
        prefix = base
        prefix = module

    path = getPath('Extensions', prefix, suffixes=('','py','pyc'))
    if path is None:
        raise NotFound("The specified module, '%s', couldn't be found."
                        % module)

    __traceback_info__= path, module

    base, ext = os.path.splitext(path)
    if ext=='.pyc':
        file = open(path, 'rb')
        binmod = imp.load_compiled('Extension', path, file)
        module_dict = binmod.__dict__
            execsrc = open(path)
            raise NotFound("The specified module, '%s', "
                           "couldn't be opened." % module)
        module_dict = {}
        exec execsrc in module_dict

    if old is not None:
        # XXX Accretive??
        modules[module] = module_dict

        return module_dict[name]
    except KeyError:
        raise NotFound("The specified object, '%s', was not found "
                       "in module, '%s'." % (name, module))

src/p/r/Products.ExternalMethod-2.13.0/src/Products/ExternalMethod/ExternalMethod.py   Products.ExternalMethod(Download)
from Acquisition import Acquired
from Acquisition import Explicit
from App.Extensions import getObject
from App.Extensions import getPath
from App.Extensions import FuncCode
    def getFunction(self, reload=0):
        f = getObject(self._module, self._function, reload)
        if hasattr(f, 'im_func'):
            ff = f.im_func

src/p/r/Products.ZSQLMethods-2.13.4/src/Shared/DC/ZRDB/DA.py   Products.ZSQLMethods(Download)
from AccessControl.SecurityManagement import getSecurityManager
from Acquisition import Implicit
from App.Extensions import getObject
from App.special_dtml import DTMLFile
from DocumentTemplate import HTML

src/z/o/Zope2-2.13.22/src/App/tests/test_Extensions.py   Zope2(Download)
    def _callFUT(self, module, name, reload=0, modules=None):
        from App.Extensions import getObject
        if modules is not None:
            return getObject(module, name, reload, modules)
        return getObject(module, name, reload)