components/variations/service/generate_ui_string_overrider.py
def _GenDataArray(
    resources, entry_pattern, array_name, array_type, data_getter):
  """Generates a C++ statement defining a literal array containing the hashes.

  Args:
    resources: A sorted list of |Resource| objects.
    entry_pattern: A pattern to be used to generate each entry in the array. The
        pattern is expected to have a place for data and one for a comment, in
        that order.
    array_name: The name of the array being generated.
    array_type: The type of the array being generated.
    data_getter: A function that gets the array data from a |Resource| object.

  Returns:
    A string containing a C++ statement defining the an array.
  """
  lines = [entry_pattern % (data_getter(r), r.name) for r in resources]
  pattern = """const %(type)s %(name)s[] = {
%(content)s
};
"""
  return pattern % {'type': array_type,
                    'name': array_name,
                    'content': '\n'.join(lines)}
Generates a C++ statement defining a literal array containing the hashes.

  Args:
    resources: A sorted list of |Resource| objects.
    entry_pattern: A pattern to be used to generate each entry in the array. The
        pattern is expected to have a place for data and one for a comment, in
        that order.
    array_name: The name of the array being generated.
    array_type: The type of the array being generated.
    data_getter: A function that gets the array data from a |Resource| object.

  Returns:
    A string containing a C++ statement defining the an array.
  
Generates a C++ statement defining a literal array containing the hashes.
Generates a C ++ statement defining a literal array containing the hashes .
def _GenDataArray(
    resources, entry_pattern, array_name, array_type, data_getter):
  lines = [entry_pattern % (data_getter(r), r.name) for r in resources]
  pattern = """const %(type)s %(name)s[] = {
%(content)s
};
"""
  return pattern % {'type': array_type,
                    'name': array_name,
                    'content': '\n'.join(lines)}
def _GenDataArray ( resources , entry_pattern , array_name , array_type , data_getter ) : lines = [ entry_pattern % ( data_getter ( r ) , r . name ) for r in resources ] pattern = """const %(type)s %(name)s[] = {
%(content)s
};
""" return pattern % { 'type' : array_type , 'name' : array_name , 'content' : '\n' . join ( lines ) }
Generates a C++ statement defining a literal array containing the hashes.
Generates a C ++ statement defining a literal array containing the hashes .
"""Generates a C++ statement defining a literal array containing the hashes.

  Args:
    resources: A sorted list of |Resource| objects.
    entry_pattern: A pattern to be used to generate each entry in the array. The
        pattern is expected to have a place for data and one for a comment, in
        that order.
    array_name: The name of the array being generated.
    array_type: The type of the array being generated.
    data_getter: A function that gets the array data from a |Resource| object.

  Returns:
    A string containing a C++ statement defining the an array.
  """
A string containing a C++ statement defining the an array.
A string containing a C ++ statement defining the an array .
resources
A sorted list of |Resource| objects.
A sorted list of |Resource| objects .
entry_pattern
A pattern to be used to generate each entry in the array. The
pattern is expected to have a place for data and one for a comment, in
that order.
A pattern to be used to generate each entry in the array . The pattern is expected to have a place for data and one for a comment in that order .
array_name
The name of the array being generated.
The name of the array being generated .
array_type
The type of the array being generated.
The type of the array being generated .
data_getter
A function that gets the array data from a |Resource| object.
A function that gets the array data from a |Resource| object .