示例#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
示例#2
0
文件: config.py 项目: 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)
示例#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)
示例#4
0
文件: hooks.py 项目: 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