def describe_file(module):
 from . import remote
 descriptor = FileDescriptor()
 descriptor.package = util.get_package_for_module(module)
 if (not descriptor.package):
  descriptor.package = None
 message_descriptors = []
 enum_descriptors = []
 service_descriptors = []
 for name in sorted(dir(module)):
  value = getattr(module, name)
  if isinstance(value, type):
   if issubclass(value, messages.Message):
    message_descriptors.append(describe_message(value))
   elif issubclass(value, messages.Enum):
    enum_descriptors.append(describe_enum(value))
   elif issubclass(value, remote.Service):
    service_descriptors.append(describe_service(value))
 if message_descriptors:
  descriptor.message_types = message_descriptors
 if enum_descriptors:
  descriptor.enum_types = enum_descriptors
 if service_descriptors:
  descriptor.service_types = service_descriptors
 return descriptor

def describe_file ( module ) : from . import remote descriptor = FileDescriptor ( ) descriptor . package = util . get_package_for_module ( module ) if ( not descriptor . package ) : descriptor . package = None message_descriptors = [ ] enum_descriptors = [ ] service_descriptors = [ ] for name in sorted ( dir ( module ) ) : value = getattr ( module , name ) if isinstance ( value , type ) : if issubclass ( value , messages . Message ) : message_descriptors . append ( describe_message ( value ) ) elif issubclass ( value , messages . Enum ) : enum_descriptors . append ( describe_enum ( value ) ) elif issubclass ( value , remote . Service ) : service_descriptors . append ( describe_service ( value ) ) if message_descriptors : descriptor . message_types = message_descriptors if enum_descriptors : descriptor . enum_types = enum_descriptors if service_descriptors : descriptor . service_types = service_descriptors return descriptor
build a file from a specified python module .