biosimulators_utils.archive package#

Submodules#

biosimulators_utils.archive.data_model module#

Data model for archives (e.g., zip files)

Author:

Jonathan Karr <karr@mssm.edu>

Date:

2020-12-06

Copyright:

2020, Center for Reproducible Biomedical Modeling

License:

MIT

class biosimulators_utils.archive.data_model.Archive(files=None)[source]#

Bases: object

An archive (e.g., zip file)

files[source]#

files

Type:

list of ArchiveFile

is_equal(other)[source]#

Determine if two archives are equal

Parameters:

other (ArchiveFile) – another archive

Returns:

True, if two archives are equal

Return type:

bool

to_tuple()[source]#

Tuple representation of an archive

Returns:

tuple representation of an archive

Return type:

tuple of str

class biosimulators_utils.archive.data_model.ArchiveFile(local_path=None, archive_path=None)[source]#

Bases: object

A file in a archive (e.g., zip file)

local_path[source]#

path within local filesytem

Type:

str

archive_path[source]#

archive_path

Type:

str

is_equal(other)[source]#

Determine if two files are equal

Parameters:

other (ArchiveFile) – another file

Returns:

True, if two files are equal

Return type:

bool

to_tuple()[source]#

Tuple representation of a file

Returns:

tuple representation of a file

Return type:

tuple of str

biosimulators_utils.archive.io module#

Utilities for creating zip archives

Author:

Jonathan Karr <karr@mssm.edu>

Date:

2020-12-06

Copyright:

2020, Center for Reproducible Biomedical Modeling

License:

MIT

class biosimulators_utils.archive.io.ArchiveReader[source]#

Bases: object

Class for reading zip archives

run(archive_filename, out_dir=None)[source]#

Unpack the files in a zip archive

Parameters:
  • archive_filename (str) – path to zip file

  • out_dir (str, optional) – path to unpack files

Returns:

files unbundled from zip archive

Return type:

archive (Archive)

class biosimulators_utils.archive.io.ArchiveWriter[source]#

Bases: object

Class for writing zip archives

run(archive, archive_filename)[source]#

Bundle a list of files into a zip archive

Parameters:
  • archive (Archive) – files to bundle into a zip archive

  • archive_filename (str) – path to save zip file

biosimulators_utils.archive.utils module#

Utilities for creating archives

Author:

Jonathan Karr <karr@mssm.edu>

Date:

2020-12-06

Copyright:

2020, Center for Reproducible Biomedical Modeling

License:

MIT

biosimulators_utils.archive.utils.build_archive_from_paths(path_patterns, rel_path=None, recursive=True)[source]#

Build an archive from a list of glob path patterns

Parameters:
  • path_patterns (list of str) – glob path patterns for files to bundle into an archive

  • rel_path (str, optional) – if provided, set the archive file names to their path relative to this path

  • recursive (bool, optional) – if True, match the path patterns recursively

Returns:

archive

Return type:

Archive