Files

Utility classes for handling local and remote files.

File

dcase_util.files.File

Generic file class.

File(*args, **kwargs)

Generic file class

File.load([filename])

Load file

File.save(data[, filename])

Save file

File.get_file_information()

Get file information, filename

File.detect_file_format([filename])

Detect file format from extension

File.validate_format()

Validate file format

File.exists()

Checks that file exists

File.empty()

Check if file is empty

File.delimiter([exclude_delimiters])

Use csv.sniffer to guess delimiter for CSV file

File.is_package([filename])

Determine if the file is compressed package.

Package

dcase_util.files.Package

Generic package class.

Package(*args, **kwargs)

Generic package class

Package.extract([target_path, overwrite, ...])

Extract the package.

Package.compress([filename, path, ...])

Compress the package.

Package.detect_file_format([filename])

Detect file format from extension

Package.validate_format()

Validate file format

Package.exists()

Checks that file exists

FileLock

dcase_util.files.FileLock

Simple file-based locking class.

FileLock(filename[, timeout, ...])

Simple file-based locking class.

FileLock.lock()

Lock file.

FileLock.release()

Release file lock.

FileLock.expired

Check is the locking file older than specified timeout.

FileLock.is_locked

Check does the locking file exists.

FileLock.touch()

Create locking file with current time stamp.

RemoteFile

dcase_util.files.RemoteFile

Remote file handling class.

RemoteFile([filename, content_type, ...])

Remote file class

RemoteFile.download()

Download remote file and save it as local file.

RemoteFile.is_content_type(content_type)

Check that file contains given type of content

RemoteFile.local_md5

Checksum for local file.

RemoteFile.local_modified

Modification timestamp for local file.

RemoteFile.local_bytes

File size of local file in bytes.

RemoteFile.local_size_string()

File size of local file in human readable form.

RemoteFile.local_exists()

Check does the local file exists.

RemoteFile.local_changed()

Check does the local file corresponds to remote file (based on checksum or modification times and file size).

RemoteFile.remote_file

URL to remote file

RemoteFile.remote_modified

Last modification time for remote file.

RemoteFile.remote_bytes

File size of remote file.

RemoteFile.remote_status

Status of remote file.

RemoteFile.remote_size_string()

File size of remote file in human readable form.

RemoteFile.remote_info()

Get information about the remove file (status, size, checksum, last modification time).

RemoteFile.remote_exists()

Check does the remote file exists (based on HTTP status code).

RemotePackage

dcase_util.files.RemotePackage

Remote package handling class.

RemotePackage([filename, content_type, ...])

Remote package class

RemotePackage.download()

Download remote file and save it as local file.

RemotePackage.extract([target_path, ...])

Extract the package.

RemotePackage.package_password

Package password

RemotePackage.is_content_type(content_type)

Check that file contains given type of content

RemotePackage.local_md5

Checksum for local file.

RemotePackage.local_modified

Modification timestamp for local file.

RemotePackage.local_bytes

File size of local file in bytes.

RemotePackage.local_size_string()

File size of local file in human readable form.

RemotePackage.local_exists()

Check does the local file exists.

RemotePackage.local_changed()

Check does the local file corresponds to remote file (based on checksum or modification times and file size).

RemotePackage.remote_file

URL to remote file

RemotePackage.remote_modified

Last modification time for remote file.

RemotePackage.remote_bytes

File size of remote file.

RemotePackage.remote_status

Status of remote file.

RemotePackage.remote_size_string()

File size of remote file in human readable form.

RemotePackage.remote_info()

Get information about the remove file (status, size, checksum, last modification time).

RemotePackage.remote_exists()

Check does the remote file exists (based on HTTP status code).

Serializer

dcase_utils.files.Serializer

Data serialization class.

Serializer()

Data serialization class

Serializer.load_yaml(filename)

Load YAML file

Serializer.load_cpickle(filename)

Load CPICKLE file

Serializer.load_json(filename)

Load JSON file

Serializer.load_msgpack(filename)

Load MSGPACK file

Serializer.load_marshal(filename)

Load MARSHAL file

Serializer.save_yaml(filename, data)

Save data into YAML file

Serializer.save_cpickle(filename, data)

Save data into CPICKLE file

Serializer.save_json(filename, data)

Save data into JSON file

Serializer.save_msgpack(filename, data)

Save data into MSGPACK file

Serializer.save_marshal(filename, data)

Save data into MARSHAL file