ProtoCaller.Utils.fileio module

class ProtoCaller.Utils.fileio.Dir(dirname, copydirname=None, overwrite=False, temp=False, purge_immediately=True)

Bases: object

A class that handles directory changes in Python in a more intuitive way.

Parameters
  • dirname (str) – Initialises dirname.

  • copydirname (str or None) – Initialises copydirname.

  • overwrite (bool) – Initialises overwrite.

  • temp (bool) – Initialises temp.

  • purge_immediately (bool) – Initialise purge_immediately.

workdirname

The absolute path to the parent directory of Dir.

Type

str

dirname

The directory name.

Type

str

copydirname

If not None, copies the directory in copydirname as a basis for Dir.

Type

str or None

path

Full absolute path of the directory.

Type

str

overwrite

Whether to overwrite any directories with the same name as Dir.

Type

bool

temp

If True, the directory is deleted upon __exit__.

Type

bool

purge_immediately

If True, the directory is only deleted upon program exit. Only valid if temp is True.

Type

bool

initialdirnames

Keeps track of different places from which __enter__ has been called in order to avoid mistakes.

Type

[str]

ProtoCaller.Utils.fileio.checkFileExists(files)

A simple wrapper around os.path.exists which throws an error if False.