Exemplo n.º 1
0
    def newImp(name,
               globals=None,
               locals=None,
               fromlist=None,
               *rest,
               **kwargs):
        if name == EcModuleName:
            core.setActiveModule(getCallingModule())

            return origImp(name, globals, locals, fromlist, *rest, **kwargs)

        else:
            imported = origImp(name, globals, locals, fromlist, *rest,
                               **kwargs)
            module_name = getModuleFullName(imported, globals)

            if fromlist and sys.modules.has_key(
                    '%s.%s' % (module_name, fromlist[0])
            ):  # several modules from a package are being imported in a single statement. Ex: from pkg import m1, m2
                for item in fromlist:
                    processModule('%s.%s' % (module_name, item))

            else:
                processModule(module_name)

            return imported
Exemplo n.º 2
0
Arquivo: config.py Projeto: Laufire/ec
def module(**Config):
  r"""Helps with adding configs to Modules.

  Note:
    Config is a same as that of **group**.
  """
  Underlying = getCallingModule()
  Underlying.__ec_member__.Config.update(**Config)
Exemplo n.º 3
0
def module(**Config):
    r"""Helps with adding configs to Modules.

  Note:
    Config is a same as that of **group**.
  """
    Underlying = getCallingModule()
    Underlying.__ec_member__.Config.update(**Config)
Exemplo n.º 4
0
Arquivo: hooks.py Projeto: Laufire/ec
  def newImp(name, globals=None, locals=None, fromlist=None, *rest, **kwargs):
    if name == EcModuleName:
      core.setActiveModule(getCallingModule())

      return origImp(name, globals, locals, fromlist, *rest, **kwargs)

    else:
      imported = origImp(name, globals, locals, fromlist, *rest, **kwargs)
      module_name = getModuleFullName(imported, globals)

      if fromlist and sys.modules.has_key('%s.%s' % (module_name, fromlist[0])): # several modules from a package are being imported in a single statement. Ex: from pkg import m1, m2
        for item in fromlist:
          processModule('%s.%s' % (module_name, item))

      else:
        processModule(module_name)

      return imported