Model Functions

Below is a complete listing of python functions accessible to models as commands. That is, commands of type: python_method must have a func defined in this file, in addition to args and kwargs corresponding to the func.

For example, a valid command object is:

cmds: replace_file_in_zip
type: python_method
args:
    - a_new_file.txt
    - zip_archive.zip
    - the_old_file.txt
kwargs:
    tmp_dir: tmp_dir

Specifications

modfuncs.replace_file_in_zip(new_file: str, *old_file, tmp_dir: str = 'tmp_zipfile') → str[source]

Replaces a file in a zip archive with a new_file.

Parameters:
  • new_file (str) – The file to add to the archive.
  • old_file ("List[str]") – Arguments, in order, that identify the old file. For example, if the file to be replaced is a_file.txt in the folder a_folder in the zip archive a_zip.zip, then the function signature is replace_file_in_zip("new_file.txt", "a_zip.zip", "a_folder", "a_file.txt").
  • tmp_dir (str) – The directory in which the contents of the zip file are temporarily extracted to.
Return str:

The new zip file.

Created on Feb 27 09:10:22 2018

Section author: Lyle Collins <Lyle.Collins@csiro.au>

Code author: Lyle Collins <Lyle.Collins@csiro.au>