pycoffer package

Subpackages

Submodules

pycoffer.config module

Config lib

class pycoffer.config.Config(filename, chkmode=True)

Bases: object

classmethod Defaults(filename=None)

Return defaults from configuration file

check_perms(exc=True)

Check user right on config file. Must be 600 !!!

coffer(section=None)

Return a coffer matching section

classmethod generate(coffer_name=None, type=None, location=None, auth='file', backup=None, filename=None)

Return a coffer configuration as a list of lines

get_defaults(filename=None)

Return defaults from configuration file

pycoffer.main module

pycoffer main script.

pycoffer.main_cli module

pyfernet main script.

pycoffer.main_lib module

pyfernet main script.

pycoffer.main_lib.open_coffer(conf, store, mode)

pycoffer.main_static module

pycoffer static main script.

pycoffer.malloc module

Module contents

A secure storage

class pycoffer.Coffer(filename=None, mode=None, fileobj=None, auto_flush=True, backup=None, secure_open=None, secure_params=None, container_class=None, container_params=None, lock_timeout=1, lock_type='rw', temp_dir=None, **kwargs)

Bases: object

add(filename, arcname=None, replace=True)

Add file/dir in the store. arcname the is dest . If arcname exists, it is replaced by default. Otherwise an exception is raised

append(data, arcname=None)

Append data to arcname

close()

Close the store. If file is open for writing, the store is rewriting

property closed

True if this file is closed.

crypt_open(filename, mode='r', **kwargs)

Return a crypting open function to encrypt esternal files for examples. Use keys of the coffer.

delete(arcname=None)

Delete file in store

delete_raw(arcinfo=None)

Delete file in store without lock

extract(arcname, path='.')

Extract arcname to path

extractall(path='.', members=None)

Extract all files (or only members) to path

file(arcname=None, mode='rb', encoding=None)

Return a file descriptor on arcname

filename = None
flush(force=True)

Flush data to store if needed. Unless force is True

classmethod gen_params()

Generate params for a new store : keys, … as a dict

getmembers()

Get members or the store

property modified

Archive has been updated but not flushed.

property mtime

Last modification time read from stream, or None.

open()

Open the store with a lock

pickle_dump(data, arcname=None)

Dump pickle to coffer

pickle_load(arcname=None)

Load pickle from coffer

plugin(name=None, group='cofferfile.plugin')

Return a plugin

read(arcname=None)

Read data from arcname

property readable

Return whether the file was opened for reading.

readlines(arcname=None, encoding='UTF-8')

Read a list of lines from arcname

property writable

Return whether the file was opened for writing.

write(data, arcname=None)

Write data to arcname

writelines(lines, arcname=None, encoding='UTF-8')

Write a list of lines to arcname

class pycoffer.CofferInfo(name, store_path=None)

Bases: object

property atime

The atime of the file in tmp

property filesize

The size of the file in tmp

property mtime

The mtime of the file in tmp

pycoffer.open(filename, mode='rb', secret_key=None, chunk_size=65504, auto_flush=True, backup=None, secure_open=None, secure_params=None, container_class=None, container_params=None, **kwargs)

Open a Coffer file in binary or text mode.

The filename argument can be an actual filename (a str or bytes object), or an existing file object to read from or write to.

The mode argument can be “r”, “rb”, “w”, “wb”, “x”, “xb”, “a” or “ab” for binary mode.