tools/android/find_unused_resources.py
def GetLibraryResources(r_txt_paths):
  """Returns the resources packaged in a list of libraries.

  Args:
    r_txt_paths: paths to each library's generated R.txt file which lists the
        resources it contains.

  Returns:
    The resources in the libraries as a list of tuples (type, name). Example:
    [('drawable', 'arrow'), ('layout', 'month_picker'), ...]
  """
  resources = []
  for r_txt_path in r_txt_paths:
    with open(r_txt_path, 'r') as f:
      for line in f:
        line = line.strip()
        if not line:
          continue
        data_type, res_type, name, _ = line.split(None, 3)
        assert data_type in ('int', 'int[]')
        # Hide attrs, which are redundant with styleables and always appear
        # unused, and hide ids, which are innocuous even if unused.
        if res_type in ('attr', 'id'):
          continue
        resources.append((res_type, name))
  return resources
Returns the resources packaged in a list of libraries.

  Args:
    r_txt_paths: paths to each library's generated R.txt file which lists the
        resources it contains.

  Returns:
    The resources in the libraries as a list of tuples (type, name). Example:
    [('drawable', 'arrow'), ('layout', 'month_picker'), ...]
  
Returns the resources packaged in a list of libraries.
Returns the resources packaged in a list of libraries .
def GetLibraryResources(r_txt_paths):
  resources = []
  for r_txt_path in r_txt_paths:
    with open(r_txt_path, 'r') as f:
      for line in f:
        line = line.strip()
        if not line:
          continue
        data_type, res_type, name, _ = line.split(None, 3)
        assert data_type in ('int', 'int[]')
        if res_type in ('attr', 'id'):
          continue
        resources.append((res_type, name))
  return resources
def GetLibraryResources ( r_txt_paths ) : resources = [ ] for r_txt_path in r_txt_paths : with open ( r_txt_path , 'r' ) as f : for line in f : line = line . strip ( ) if not line : continue data_type , res_type , name , _ = line . split ( None , 3 ) assert data_type in ( 'int' , 'int[]' ) if res_type in ( 'attr' , 'id' ) : continue resources . append ( ( res_type , name ) ) return resources
Returns the resources packaged in a list of libraries.
Returns the resources packaged in a list of libraries .
"""Returns the resources packaged in a list of libraries.

  Args:
    r_txt_paths: paths to each library's generated R.txt file which lists the
        resources it contains.

  Returns:
    The resources in the libraries as a list of tuples (type, name). Example:
    [('drawable', 'arrow'), ('layout', 'month_picker'), ...]
  """ # Hide attrs, which are redundant with styleables and always appear # unused, and hide ids, which are innocuous even if unused.
The resources in the libraries as a list of tuples (type, name).
The resources in the libraries as a list of tuples ( type name ) .
r_txt_paths
paths to each library's generated R.txt file which lists the
resources it contains.
paths to each library ' s generated R . txt file which lists the resources it contains .