components/sync/PRESUBMIT.py
def CheckNoDuplicatedFieldValues(output_api, map_entries):
  """Check that map_entries has no duplicated field values.
  Verifies that every map_entry in map_entries doesn't have a field value
  used elsewhere in map_entries, ignoring special values ("" and -1).
  Args:
    output_api: presubmit_support OutputApi instance
    map_entries: list of ModelTypeEnumEntry objects to check
  Returns:
    A list PresubmitError objects for each duplicated field value
  """
  problem_list = []
  field_value_sets = [set() for i in range(MAP_ENTRY_FIELD_COUNT)]
  for map_entry in map_entries:
    field_values = [
      map_entry.model_type, map_entry.notification_type,
      map_entry.root_tag, map_entry.model_type_string,
      map_entry.field_number, map_entry.histogram_val]
    for i in range(MAP_ENTRY_FIELD_COUNT):
      field_value = field_values[i]
      field_value_set = field_value_sets[i]
      if field_value in field_value_set:
        problem_list.append(
          FormatPresubmitError(
            output_api, 'Duplicated field value "%s"' % field_value,
            map_entry.affected_lines))
      elif len(field_value) > 0 and field_value != '-1':
        field_value_set.add(field_value)
  return problem_list
Check that map_entries has no duplicated field values.
  Verifies that every map_entry in map_entries doesn't have a field value
  used elsewhere in map_entries, ignoring special values ("" and -1).
  Args:
    output_api: presubmit_support OutputApi instance
    map_entries: list of ModelTypeEnumEntry objects to check
  Returns:
    A list PresubmitError objects for each duplicated field value
  
Check that map_entries has no duplicated field values.
Verifies that every map_entry in map_entries doesn't have a field value
used elsewhere in map_entries, ignoring special values ("" and -1).
Check that map_entries has no duplicated field values . Verifies that every map_entry in map_entries doesn ' t have a field value used elsewhere in map_entries ignoring special values ( " " and - 1 ) .
def CheckNoDuplicatedFieldValues(output_api, map_entries):
  problem_list = []
  field_value_sets = [set() for i in range(MAP_ENTRY_FIELD_COUNT)]
  for map_entry in map_entries:
    field_values = [
      map_entry.model_type, map_entry.notification_type,
      map_entry.root_tag, map_entry.model_type_string,
      map_entry.field_number, map_entry.histogram_val]
    for i in range(MAP_ENTRY_FIELD_COUNT):
      field_value = field_values[i]
      field_value_set = field_value_sets[i]
      if field_value in field_value_set:
        problem_list.append(
          FormatPresubmitError(
            output_api, 'Duplicated field value "%s"' % field_value,
            map_entry.affected_lines))
      elif len(field_value) > 0 and field_value != '-1':
        field_value_set.add(field_value)
  return problem_list
def CheckNoDuplicatedFieldValues ( output_api , map_entries ) : problem_list = [ ] field_value_sets = [ set ( ) for i in range ( MAP_ENTRY_FIELD_COUNT ) ] for map_entry in map_entries : field_values = [ map_entry . model_type , map_entry . notification_type , map_entry . root_tag , map_entry . model_type_string , map_entry . field_number , map_entry . histogram_val ] for i in range ( MAP_ENTRY_FIELD_COUNT ) : field_value = field_values [ i ] field_value_set = field_value_sets [ i ] if field_value in field_value_set : problem_list . append ( FormatPresubmitError ( output_api , 'Duplicated field value "%s"' % field_value , map_entry . affected_lines ) ) elif len ( field_value ) > 0 and field_value != '-1' : field_value_set . add ( field_value ) return problem_list
Check that map_entries has no duplicated field values.
Check that map_entries has no duplicated field values .
"""Check that map_entries has no duplicated field values.
  Verifies that every map_entry in map_entries doesn't have a field value
  used elsewhere in map_entries, ignoring special values ("" and -1).
  Args:
    output_api: presubmit_support OutputApi instance
    map_entries: list of ModelTypeEnumEntry objects to check
  Returns:
    A list PresubmitError objects for each duplicated field value
  """
A list PresubmitError objects for each duplicated field value
A list PresubmitError objects for each duplicated field value
output_api
presubmit_support OutputApi instance
presubmit_support OutputApi instance
map_entries
list of ModelTypeEnumEntry objects to check
list of ModelTypeEnumEntry objects to check