components/sync/PRESUBMIT.py
def CheckNotificationTypeMatchesProtoMessageName(
  output_api, map_entry, proto_field_definitions):
  """Check that map_entry's notification type matches entity_specifics.proto.
  Verifies that the notification_type matches the name of the field defined
  in the entity_specifics.proto by looking it up in the proto_field_definitions
  map.
  Args:
    output_api: presubmit_support OutputApi instance
    map_entry: ModelTypeEnumEntry instance
    proto_field_definitions: dict of proto field types and field names
  Returns:
    A potentially empty list of PresubmitError objects corresponding to
    violations of the above rule
  """
  if map_entry.field_number == '-1':
    return []
  proto_message_name = proto_field_definitions[
    FieldNumberToPrototypeString(map_entry.field_number)]
  if map_entry.notification_type.lower() != proto_message_name:
    return [
      FormatPresubmitError(
        output_api,'In the construction of ModelTypeInfo: notification type'
        ' "%s" does not match proto message'
        ' name defined in entity_specifics.proto: ' '"%s"' %
        (map_entry.notification_type, proto_message_name),
        map_entry.affected_lines)]
  return []
Check that map_entry's notification type matches entity_specifics.proto.
  Verifies that the notification_type matches the name of the field defined
  in the entity_specifics.proto by looking it up in the proto_field_definitions
  map.
  Args:
    output_api: presubmit_support OutputApi instance
    map_entry: ModelTypeEnumEntry instance
    proto_field_definitions: dict of proto field types and field names
  Returns:
    A potentially empty list of PresubmitError objects corresponding to
    violations of the above rule
  
Check that map_entry's notification type matches entity_specifics.proto.
Verifies that the notification_type matches the name of the field defined
in the entity_specifics.proto by looking it up in the proto_field_definitions
map.
Check that map_entry ' s notification type matches entity_specifics . proto . Verifies that the notification_type matches the name of the field defined in the entity_specifics . proto by looking it up in the proto_field_definitions map .
def CheckNotificationTypeMatchesProtoMessageName(
  output_api, map_entry, proto_field_definitions):
  if map_entry.field_number == '-1':
    return []
  proto_message_name = proto_field_definitions[
    FieldNumberToPrototypeString(map_entry.field_number)]
  if map_entry.notification_type.lower() != proto_message_name:
    return [
      FormatPresubmitError(
        output_api,'In the construction of ModelTypeInfo: notification type'
        ' "%s" does not match proto message'
        ' name defined in entity_specifics.proto: ' '"%s"' %
        (map_entry.notification_type, proto_message_name),
        map_entry.affected_lines)]
  return []
def CheckNotificationTypeMatchesProtoMessageName ( output_api , map_entry , proto_field_definitions ) : if map_entry . field_number == '-1' : return [ ] proto_message_name = proto_field_definitions [ FieldNumberToPrototypeString ( map_entry . field_number ) ] if map_entry . notification_type . lower ( ) != proto_message_name : return [ FormatPresubmitError ( output_api , 'In the construction of ModelTypeInfo: notification type' ' "%s" does not match proto message' ' name defined in entity_specifics.proto: ' '"%s"' % ( map_entry . notification_type , proto_message_name ) , map_entry . affected_lines ) ] return [ ]
Check that map_entry's notification type matches entity_specifics.proto.
Check that map_entry ' s notification type matches entity_specifics . proto .
"""Check that map_entry's notification type matches entity_specifics.proto.
  Verifies that the notification_type matches the name of the field defined
  in the entity_specifics.proto by looking it up in the proto_field_definitions
  map.
  Args:
    output_api: presubmit_support OutputApi instance
    map_entry: ModelTypeEnumEntry instance
    proto_field_definitions: dict of proto field types and field names
  Returns:
    A potentially empty list of PresubmitError objects corresponding to
    violations of the above rule
  """
A potentially empty list of PresubmitError objects corresponding to
violations of the above rule
A potentially empty list of PresubmitError objects corresponding to violations of the above rule
output_api
presubmit_support OutputApi instance
presubmit_support OutputApi instance
map_entry
None
proto_field_definitions
dict of proto field types and field names
dict of proto field types and field names