parameters: (file_name)
docstring: Returns a list of devices.
  
    Args:
      file_name: the file name containing a list of devices.
  
    Returns: List of device serial numbers that were on the bot.
docstring_summary: Returns a list of devices.
docstring_tokens: Returns a list of devices .
function: def GetPersistentDeviceList(file_name):
    """Returns a list of devices.
  
    Args:
      file_name: the file name containing a list of devices.
  
    Returns: List of device serial numbers that were on the bot.
    """
    if not os.path.isfile(file_name):
      logger.warning("Device file %s doesn't exist.", file_name)
      return []
  
    try:
      with open(file_name) as f:
        devices = json.load(f)
      if not isinstance(devices, list) or not all(isinstance(d, basestring)
                                                  for d in devices):
        logger.warning('Unrecognized device file format: %s', devices)
        return []
      return [d for d in devices if d != '(error)']
    except ValueError:
      logger.exception(
          'Error reading device file %s. Falling back to old format.', file_name)
  
    # TODO(bpastene) Remove support for old unstructured file format.
    with open(file_name) as f:
      return [d for d in f.read().splitlines() if d != '(error)']
function_tokens: def GetPersistentDeviceList ( file_name ) : if not os . path . isfile ( file_name ) : logger . warning ( "Device file %s doesn't exist." , file_name ) return [ ] try : with open ( file_name ) as f : devices = json . load ( f ) if not isinstance ( devices , list ) or not all ( isinstance ( d , basestring ) for d in devices ) : logger . warning ( 'Unrecognized device file format: %s' , devices ) return [ ] return [ d for d in devices if d != '(error)' ] except ValueError : logger . exception ( 'Error reading device file %s. Falling back to old format.' , file_name ) # TODO(bpastene) Remove support for old unstructured file format. with open ( file_name ) as f : return [ d for d in f . read ( ) . splitlines ( ) if d != '(error)' ]