def _write_enums(enum_descriptors, out):
 for enum in (enum_descriptors or []):
  (out << '')
  (out << '')
  (out << ('class %s(messages.Enum):' % enum.name))
  (out << '')
  with out.indent():
   if (not enum.values):
    (out << 'pass')
   else:
    for enum_value in enum.values:
     (out << ('%s = %s' % (enum_value.name, enum_value.number)))

def _write_enums ( enum_descriptors , out ) : for enum in ( enum_descriptors or [ ] ) : ( out << '' ) ( out << '' ) ( out << ( 'class %s(messages.Enum):' % enum . name ) ) ( out << '' ) with out . indent ( ) : if ( not enum . values ) : ( out << 'pass' ) else : for enum_value in enum . values : ( out << ( '%s = %s' % ( enum_value . name , enum_value . number ) ) )
write nested and non-nested enum types .