def from_code(path):
        path = getabspath(path)
        module_name = getmodulename(path)
        res = TypeModule(cfg_wrapper.import_module(path), module_name, path)
        prev_state = _state

        TypeCallable._set_state(RootState)
        res.call("types", 0)
        res._set_attrs()
        TypeCallable._set_state(prev_state)
        import_table[path] = res
        return res
    def from_code(path):
        path = getabspath(path)
        module_name = getmodulename(path)
        res = TypeModule(cfg_wrapper.import_module(path), module_name, path)
        prev_state = _state

        TypeCallable._set_state(RootState)
        res.call("types", 0)
        res._set_attrs()
        TypeCallable._set_state(prev_state)
        import_table[path] = res
        return res
 def from_code(path):
     path = getabspath(path)
     module_name = getmodulename(path)
     init_path = os.path.join(path, "__init__.py")
     #        print "IMPORTING PACKAGE %r" % path
     if os.path.exists(init_path):
         #            print "FOUND INIT %r" % init_path
         module_name = getmodulename(init_path)
         res = TypePackage(cfg_wrapper.import_module(init_path), module_name, path)
         prev_state = _state
         TypeCallable._set_state(RootState)
         res.call("types", 0)
         res._set_attrs()
         TypeCallable._set_state(prev_state)
     else:
         res = TypePackage(None, module_name, path)
     import_table[path] = res
     return res
 def from_code(path):
     path = getabspath(path)
     module_name = getmodulename(path)
     init_path = os.path.join(path, '__init__.py')
     #        print "IMPORTING PACKAGE %r" % path
     if os.path.exists(init_path):
         #            print "FOUND INIT %r" % init_path
         module_name = getmodulename(init_path)
         res = TypePackage(cfg_wrapper.import_module(init_path),
                           module_name, path)
         prev_state = _state
         TypeCallable._set_state(RootState)
         res.call("types", 0)
         res._set_attrs()
         TypeCallable._set_state(prev_state)
     else:
         res = TypePackage(None, module_name, path)
     import_table[path] = res
     return res