Esempio 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
Esempio n. 2
0
File: config.py Progetto: 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)
Esempio 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)
Esempio n. 4
0
File: hooks.py Progetto: 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