def _AddPropertiesForField(field, cls):
 assert (_FieldDescriptor.MAX_CPPTYPE == 10)
 constant_name = (field.name.upper() + '_FIELD_NUMBER')
 setattr(cls, constant_name, field.number)
 if (field.label == _FieldDescriptor.LABEL_REPEATED):
  _AddPropertiesForRepeatedField(field, cls)
 elif (field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE):
  _AddPropertiesForNonRepeatedCompositeField(field, cls)
 else:
  _AddPropertiesForNonRepeatedScalarField(field, cls)

def _AddPropertiesForField ( field , cls ) : assert ( _FieldDescriptor . MAX_CPPTYPE == 10 ) constant_name = ( field . name . upper ( ) + '_FIELD_NUMBER' ) setattr ( cls , constant_name , field . number ) if ( field . label == _FieldDescriptor . LABEL_REPEATED ) : _AddPropertiesForRepeatedField ( field , cls ) elif ( field . cpp_type == _FieldDescriptor . CPPTYPE_MESSAGE ) : _AddPropertiesForNonRepeatedCompositeField ( field , cls ) else : _AddPropertiesForNonRepeatedScalarField ( field , cls )
adds a public property for a protocol message field .