Ejemplo n.º 1
0
 def module(self, mod_name):
     __import__(mod_name)
     with self.fmt.module(mod_name):
         module = sys.modules[mod_name]
         members = inspect.getmembers(module, inspect.isclass)
         functions = inspect.getmembers(module, inspect.isroutine)
         ret = self.result_type()
         self.fmt.class_name = None
         for class_name, klass in members:
             ret.update(self.klass(class_name, klass))
         if isinstance(klass, EnumType):
             self.enum(klass)
         for func_name, func in functions:
             ret.update(self.function(func_name, func))
         return ret
Ejemplo n.º 2
0
 def module(self, mod_name):
     __import__(mod_name)
     self.fmt.mod_name = mod_name
     with self.fmt.module(mod_name):
         module = sys.modules[mod_name]
         members = inspect.getmembers(module, inspect.isclass)
         functions = inspect.getmembers(module, inspect.isroutine)
         ret = self.result_type()
         self.fmt.class_name = None
         for class_name, klass in members:
             ret.update(self.klass(class_name, klass))
         if isinstance(klass, EnumType):
             raise SystemError("implement enum instances at module level")
         for func_name, func in functions:
             ret.update(self.function(func_name, func))
         return ret