tools/metrics/histograms/expand_owners.py
def _GetHigherLevelOwnersFilePath(path):
  """Returns a path to an OWNERS file at a higher level than the given path.

  Returns an empty string if an OWNERS file path in a higher level directory
  cannot be found.

  Suppose the given path is //stuff/chromium/src/jam/tea/milk/OWNERS. The
  path //stuff/chromium/src/jam/tea/OWNERS will then be generated, and if it
  exists, it will be returned. If not, the path //stuff/chromium/src/jam/OWNERS
  will be generated, and if it exists, it will be returned.

  Args:
    path: The path to an OWNERS file.
  """
  # The highest directory that is searched for component information is one
  # directory lower than the directory above tools. Depending on the machine
  # running this code, the directory above tools may or may not be src.
  path_to_limiting_dir = os.path.abspath(os.path.join(*DIR_ABOVE_TOOLS))
  limiting_dir = path_to_limiting_dir.split(os.sep)[-1]
  owners_file_limit = (os.sep).join([limiting_dir, _OWNERS])
  if path.endswith(owners_file_limit):
    return ''

  parent_directory = os.path.dirname(os.path.dirname(path))
  parent_owners_file_path = os.path.join(parent_directory, _OWNERS)

  if (os.path.exists(parent_owners_file_path) and
    os.path.isfile(parent_owners_file_path)):
    return parent_owners_file_path
  return _GetHigherLevelOwnersFilePath(parent_owners_file_path)
Returns a path to an OWNERS file at a higher level than the given path.

  Returns an empty string if an OWNERS file path in a higher level directory
  cannot be found.

  Suppose the given path is //stuff/chromium/src/jam/tea/milk/OWNERS. The
  path //stuff/chromium/src/jam/tea/OWNERS will then be generated, and if it
  exists, it will be returned. If not, the path //stuff/chromium/src/jam/OWNERS
  will be generated, and if it exists, it will be returned.

  Args:
    path: The path to an OWNERS file.
  
Returns a path to an OWNERS file at a higher level than the given path.
Returns an empty string if an OWNERS file path in a higher level directory
cannot be found.


Returns a path to an OWNERS file at a higher level than the given path . Returns an empty string if an OWNERS file path in a higher level directory cannot be found .
def _GetHigherLevelOwnersFilePath(path):
  path_to_limiting_dir = os.path.abspath(os.path.join(*DIR_ABOVE_TOOLS))
  limiting_dir = path_to_limiting_dir.split(os.sep)[-1]
  owners_file_limit = (os.sep).join([limiting_dir, _OWNERS])
  if path.endswith(owners_file_limit):
    return ''
  parent_directory = os.path.dirname(os.path.dirname(path))
  parent_owners_file_path = os.path.join(parent_directory, _OWNERS)
  if (os.path.exists(parent_owners_file_path) and
    os.path.isfile(parent_owners_file_path)):
    return parent_owners_file_path
  return _GetHigherLevelOwnersFilePath(parent_owners_file_path)
def _GetHigherLevelOwnersFilePath ( path ) : path_to_limiting_dir = os . path . abspath ( os . path . join ( * DIR_ABOVE_TOOLS ) ) limiting_dir = path_to_limiting_dir . split ( os . sep ) [ - 1 ] owners_file_limit = ( os . sep ) . join ( [ limiting_dir , _OWNERS ] ) if path . endswith ( owners_file_limit ) : return '' parent_directory = os . path . dirname ( os . path . dirname ( path ) ) parent_owners_file_path = os . path . join ( parent_directory , _OWNERS ) if ( os . path . exists ( parent_owners_file_path ) and os . path . isfile ( parent_owners_file_path ) ) : return parent_owners_file_path return _GetHigherLevelOwnersFilePath ( parent_owners_file_path )
Returns a path to an OWNERS file at a higher level than the given path.
Returns a path to an OWNERS file at a higher level than the given path .
"""Returns a path to an OWNERS file at a higher level than the given path.

  Returns an empty string if an OWNERS file path in a higher level directory
  cannot be found.

  Suppose the given path is //stuff/chromium/src/jam/tea/milk/OWNERS. The
  path //stuff/chromium/src/jam/tea/OWNERS will then be generated, and if it
  exists, it will be returned. If not, the path //stuff/chromium/src/jam/OWNERS
  will be generated, and if it exists, it will be returned.

  Args:
    path: The path to an OWNERS file.
  """ # The highest directory that is searched for component information is one # directory lower than the directory above tools. Depending on the machine # running this code, the directory above tools may or may not be src.
path
The path to an OWNERS file.
The path to an OWNERS file .