parameters: (filename)
return_statement: return filename
docstring: Verify that there's a readable zip archive at the given path.
  
      This function returns a new name for the archive (for most cases it's
      the same as the original one; but if an archive named "foo.zip" contains
      a file named "foo" this archive will be renamed to avoid being overwrite.
docstring_summary: Verify that there's a readable zip archive at the given path.
docstring_tokens: Verify that there s a readable zip archive at the given path .
function: def _prepare_archive_at_path(filename):
      """ Verify that there's a readable zip archive at the given path.
  
      This function returns a new name for the archive (for most cases it's
      the same as the original one; but if an archive named "foo.zip" contains
      a file named "foo" this archive will be renamed to avoid being overwrite.
      """
      # Verify that the archive is actually readable
      try:
          with ZipFile(filename, "r") as archive:
              archive.close()
      except BadZipfile:
          return None
      # Test if zip file contains a file named as itself
      if _is_overwritten(filename):
          log.debug("ZIP file contains a file with the same name, original is \
          going to be overwrite")
          # In this case we just change the file name
          new_zip_path = filename + _random_extension()
          move(filename, new_zip_path)
          filename = new_zip_path
      return filename
function_tokens: def _prepare_archive_at_path ( filename ) : # Verify that the archive is actually readable try : with ZipFile ( filename , "r" ) as archive : archive . close ( ) except BadZipfile : return None # Test if zip file contains a file named as itself if _is_overwritten ( filename ) : log . debug ( "ZIP file contains a file with the same name, original is \
          going to be overwrite" ) # In this case we just change the file name new_zip_path = filename + _random_extension ( ) move ( filename , new_zip_path ) filename = new_zip_path return filename