tools/resources/find_unused_resources.py
def GetBaseResourceId(resource_id):
  """Removes common suffixes from a resource ID.

  Removes suffixies that may be added by macros like IMAGE_GRID or IMAGE_BORDER.
  For example, converts IDR_FOO_LEFT and IDR_FOO_RIGHT to just IDR_FOO.

  Args:
    resource_id: String resource ID.

  Returns:
    A string with the base part of the resource ID.
  """
  suffixes = [
      '_TOP_LEFT', '_TOP', '_TOP_RIGHT',
      '_LEFT', '_CENTER', '_RIGHT',
      '_BOTTOM_LEFT', '_BOTTOM', '_BOTTOM_RIGHT',
      '_TL', '_T', '_TR',
      '_L', '_M', '_R',
      '_BL', '_B', '_BR']
  # Note: This does not check _HOVER, _PRESSED, _HOT, etc. as those are never
  # used in macros.
  for suffix in suffixes:
    if resource_id.endswith(suffix):
      resource_id = resource_id[:-len(suffix)]
  return resource_id
Removes common suffixes from a resource ID.

  Removes suffixies that may be added by macros like IMAGE_GRID or IMAGE_BORDER.
  For example, converts IDR_FOO_LEFT and IDR_FOO_RIGHT to just IDR_FOO.

  Args:
    resource_id: String resource ID.

  Returns:
    A string with the base part of the resource ID.
  
Removes common suffixes from a resource ID.
Removes suffixies that may be added by macros like IMAGE_GRID or IMAGE_BORDER.
Removes common suffixes from a resource ID . Removes suffixies that may be added by macros like IMAGE_GRID or IMAGE_BORDER .
def GetBaseResourceId(resource_id):
  suffixes = [
      '_TOP_LEFT', '_TOP', '_TOP_RIGHT',
      '_LEFT', '_CENTER', '_RIGHT',
      '_BOTTOM_LEFT', '_BOTTOM', '_BOTTOM_RIGHT',
      '_TL', '_T', '_TR',
      '_L', '_M', '_R',
      '_BL', '_B', '_BR']
  for suffix in suffixes:
    if resource_id.endswith(suffix):
      resource_id = resource_id[:-len(suffix)]
  return resource_id
def GetBaseResourceId ( resource_id ) : suffixes = [ '_TOP_LEFT' , '_TOP' , '_TOP_RIGHT' , '_LEFT' , '_CENTER' , '_RIGHT' , '_BOTTOM_LEFT' , '_BOTTOM' , '_BOTTOM_RIGHT' , '_TL' , '_T' , '_TR' , '_L' , '_M' , '_R' , '_BL' , '_B' , '_BR' ] for suffix in suffixes : if resource_id . endswith ( suffix ) : resource_id = resource_id [ : - len ( suffix ) ] return resource_id
Removes common suffixes from a resource ID.
Removes common suffixes from a resource ID .
"""Removes common suffixes from a resource ID.

  Removes suffixies that may be added by macros like IMAGE_GRID or IMAGE_BORDER.
  For example, converts IDR_FOO_LEFT and IDR_FOO_RIGHT to just IDR_FOO.

  Args:
    resource_id: String resource ID.

  Returns:
    A string with the base part of the resource ID.
  """ # Note: This does not check _HOVER, _PRESSED, _HOT, etc. as those are never # used in macros.
A string with the base part of the resource ID.
A string with the base part of the resource ID .
resource_id
String resource ID.
String resource ID .