def define_file(file_descriptor, module=None):
 if (module is None):
  module = new.module(file_descriptor.package)
 for enum_descriptor in (file_descriptor.enum_types or []):
  enum_class = define_enum(enum_descriptor, module.__name__)
  setattr(module, enum_descriptor.name, enum_class)
 for message_descriptor in (file_descriptor.message_types or []):
  message_class = define_message(message_descriptor, module.__name__)
  setattr(module, message_descriptor.name, message_class)
 for service_descriptor in (file_descriptor.service_types or []):
  service_class = define_service(service_descriptor, module)
  setattr(module, service_descriptor.name, service_class)
 return module

def define_file ( file_descriptor , module = None ) : if ( module is None ) : module = new . module ( file_descriptor . package ) for enum_descriptor in ( file_descriptor . enum_types or [ ] ) : enum_class = define_enum ( enum_descriptor , module . __name__ ) setattr ( module , enum_descriptor . name , enum_class ) for message_descriptor in ( file_descriptor . message_types or [ ] ) : message_class = define_message ( message_descriptor , module . __name__ ) setattr ( module , message_descriptor . name , message_class ) for service_descriptor in ( file_descriptor . service_types or [ ] ) : service_class = define_service ( service_descriptor , module ) setattr ( module , service_descriptor . name , service_class ) return module
define module from filedescriptor .