parameters: (base_dir)
return_statement: return file_map
docstring: Search a directory for logcat files.
  
    Args:
      base_dir: directory to search
  
    Returns:
      Mapping of device_id to a sorted list of file paths for a given device
docstring_summary: Search a directory for logcat files.
docstring_tokens: Search a directory for logcat files .
function: def FindLogFiles(base_dir):
    """Search a directory for logcat files.
  
    Args:
      base_dir: directory to search
  
    Returns:
      Mapping of device_id to a sorted list of file paths for a given device
    """
    logcat_filter = re.compile(r'^logcat_(\S+)_(\d+)$')
    # list of tuples (<device_id>, <seq num>, <full file path>)
    filtered_list = []
    for cur_file in os.listdir(base_dir):
      matcher = logcat_filter.match(cur_file)
      if matcher:
        filtered_list += [(matcher.group(1), int(matcher.group(2)),
                           os.path.join(base_dir, cur_file))]
    filtered_list.sort()
    file_map = {}
    for device_id, _, cur_file in filtered_list:
      if device_id not in file_map:
        file_map[device_id] = []
  
      file_map[device_id] += [cur_file]
    return file_map
function_tokens: def FindLogFiles ( base_dir ) : logcat_filter = re . compile ( r'^logcat_(\S+)_(\d+)$' ) # list of tuples (<device_id>, <seq num>, <full file path>) filtered_list = [ ] for cur_file in os . listdir ( base_dir ) : matcher = logcat_filter . match ( cur_file ) if matcher : filtered_list += [ ( matcher . group ( 1 ) , int ( matcher . group ( 2 ) ) , os . path . join ( base_dir , cur_file ) ) ] filtered_list . sort ( ) file_map = { } for device_id , _ , cur_file in filtered_list : if device_id not in file_map : file_map [ device_id ] = [ ] file_map [ device_id ] += [ cur_file ] return file_map