chrome/test/data/android/upload_download_utils.py
def _get_files_to_upload(directory, filter):
  """Returns a list of files to upload to cloud storage.

  Args:
    directory: A local disk directory.
    filter: A method to filter target files inside the directory.
  """
  files_to_upload = []
  for f in os.listdir(directory):
    # Skip any files that we don't care about.
    if not filter(f):
      continue

    file_path = os.path.join(directory, f)
    # upload_to_google_storage will upload a file even if it already exists
    # in the bucket. As an optimization, hash locally and only pass files to
    # the upload script if they don't have a matching .sha1 file already.
    sha_path = file_path + '.sha1'
    if os.path.isfile(sha_path):
      with open(sha_path) as sha_file:
        with open(file_path, 'rb') as source_file:
          h = hashlib.sha1()
          h.update(source_file.read())
          if sha_file.read() == h.hexdigest():
            continue
    files_to_upload.append(file_path)
  return files_to_upload
Returns a list of files to upload to cloud storage.

  Args:
    directory: A local disk directory.
    filter: A method to filter target files inside the directory.
  
Returns a list of files to upload to cloud storage.
Returns a list of files to upload to cloud storage .
def _get_files_to_upload(directory, filter):
  files_to_upload = []
  for f in os.listdir(directory):
    if not filter(f):
      continue
    file_path = os.path.join(directory, f)
    sha_path = file_path + '.sha1'
    if os.path.isfile(sha_path):
      with open(sha_path) as sha_file:
        with open(file_path, 'rb') as source_file:
          h = hashlib.sha1()
          h.update(source_file.read())
          if sha_file.read() == h.hexdigest():
            continue
    files_to_upload.append(file_path)
  return files_to_upload
def _get_files_to_upload ( directory , filter ) : files_to_upload = [ ] for f in os . listdir ( directory ) : if not filter ( f ) : continue file_path = os . path . join ( directory , f ) sha_path = file_path + '.sha1' if os . path . isfile ( sha_path ) : with open ( sha_path ) as sha_file : with open ( file_path , 'rb' ) as source_file : h = hashlib . sha1 ( ) h . update ( source_file . read ( ) ) if sha_file . read ( ) == h . hexdigest ( ) : continue files_to_upload . append ( file_path ) return files_to_upload
Returns a list of files to upload to cloud storage.
Returns a list of files to upload to cloud storage .
"""Returns a list of files to upload to cloud storage.

  Args:
    directory: A local disk directory.
    filter: A method to filter target files inside the directory.
  """ # Skip any files that we don't care about. # upload_to_google_storage will upload a file even if it already exists # in the bucket. As an optimization, hash locally and only pass files to # the upload script if they don't have a matching .sha1 file already.
directory
A local disk directory.
A local disk directory .
filter
A method to filter target files inside the directory.
A method to filter target files inside the directory .