COT.file_reference module

Wrapper classes to abstract away differences between file sources.

class FileInTAR(tarfile_path, filename)[source]

Bases: object

Wrapper for a file inside a TAR archive or OVA.

add_to_archive(tarf)[source]

Copy this file into the given tarfile object.

close()[source]

Close the file object previously opened.

copy_to(dest_dir)[source]

Extract this file to the given destination directory.

exists()[source]

Check whether the file exists in the TAR archive.

open(mode)[source]

Open the TAR and return a reference to the relevant file object.

size()[source]

Get the size of this file in bytes.

class FileOnDisk(file_path, filename=None)[source]

Bases: object

Wrapper for a ‘real’ file on disk.

add_to_archive(tarf)[source]

Copy this file into the given tarfile object.

close()[source]

Close the file previously opened.

copy_to(dest_dir)[source]

Copy this file to the given destination directory.

exists()[source]

Check whether the file exists on disk.

open(mode)[source]

Open the file and return a reference to the file object.

size()[source]

Get the size of this file, in bytes.