utilities.CookieUtils

Usage

Source

utilities.CookieUtils()

Methods

Name Description
__init__() Various utilities to help with cookie specific functionality.
archive() Archive a database directory from a Cookie templated directory structure.
get_size() Determine the size of a directory or a file with the desired units.

__init__()

Various utilities to help with cookie specific functionality.

Usage

Source

__init__()

archive()

Archive a database directory from a Cookie templated directory structure.

Usage

Source

archive(database_path, archive_path, option, delete_flag=False)

This utility creates a YAML config dictionary that contains path-like objects for archiving. The original data can be moved to the archive path or deleted all together.

Parameters
database_path: str.

A path to a folder that consists of the desired data.

archive_path: str.

A path to an output folder for archived data.

option: str.

An option for the archiving strategy. Will be one of the keys in the archive_options.

delete_flag: bool. = False
A flag for deleting the original data. USE WITH CAUTION.
Returns
list.
Returns a list of paths to the *.tar.xz archive of the data and/or a path to the original data.

get_size()

Determine the size of a directory or a file with the desired units.

Usage

Source

get_size(start_path, units="KB")
Parameters
start_path: str.

A file or path for sizing up.

units: str. = "KB"
The denomination of bytes to return.
Returns
str.
The size as a string. (e.g. “3.6 KB”)