Python module

Type conversion

shelephant.convert.flatten(data)

Flatten a nested list to a one dimensional list.

shelephant.convert.squash(data)

Squash a dictionary to a single list.

shelephant.convert.get(data, key)

Get an item from a nested dictionary.

shelephant.convert.split_key(key)

Split a key separated by "/" in a list.

yaml handling

shelephant.yaml.read(filename)

Read YAML file and return its content.

shelephant.yaml.read_item(filename[, key])

Get an item from a YAML file.

shelephant.yaml.dump(filename, data[, force])

Dump data to YAML file.

shelephant.yaml.view(data)

Print data formatted as YAML.

File operations

shelephant.path.check_allisfile(paths)

Check that all paths point to existing files.

shelephant.path.filter_deepest(paths)

Return list with only the deepest paths.

shelephant.path.dirnames(paths[, return_unique])

Get the os.path.dirname of all file paths.

shelephant.path.makedirs(dirnames[, force])

(Prompt and) Create directories that do not yet exist.

shelephant.path.overwrite(paths[, force])

(Prompt and) List files that will be overwritten if created.

File-path operations

shelephant.relpath.add_prefix(prefix, files)

Add prefix to a list of filenames.

shelephant.relpath.chroot(files, old_root, ...)

Change the root of relative paths.

Checksum

shelephant.checksum.sha256(filename[, size])

Get sha256 of a file.

shelephant.checksum.get(filepaths[, ...])

Compute the checksums of a list of files.

ssh queries

shelephant.ssh.file_exists(host, source[, ...])

Check if a file exists on a remote system.

scp copy

shelephant.scp.from_remote(host, source, dest)

Copy a file from a remote system.

shelephant.scp.to_remote(host, source, dest)

Copy a file to a remote system.

rsync copy and queries

shelephant.rsync.diff(source_dir, dest_dir, ...)

Check if files are different using rsync.

shelephant.rsync.from_remote(hostname, ...)

Copy files from a remote system.

shelephant.rsync.to_remote(hostname, ...[, ...])

Copy files to a remote system.

Formatted print

shelephant.rich.theme([theme])

Return dictionary of colors.

shelephant.rich.String(data[, width, align, ...])

Rich string.

Details

Copy with a memory.

  1. Tom de Geus, 2021, MIT