dcase_util.utils.Path

class dcase_util.utils.Path(path=None)[source]

Utility class for paths

Constructor

Parameters
pathstr

Path, if none given one given to class constructor is used. Default value None

__init__(path=None)[source]

Constructor

Parameters
pathstr

Path, if none given one given to class constructor is used. Default value None

Methods

__init__([path])

Constructor

create([paths])

Create given paths.

exists([path])

Checks that path exists

file_count([path])

File count under given path including sub directories.

file_list([path, recursive, extensions, ...])

Get file list

makedirs([path])

Create given path.

modify([path, path_base, ...])

Modify path Parameters ---------- path : str Path, if none given one given to class constructor is used. Default value None path_base : str Replacement path base, e.g. path base for "/test/audio/audio.wav" is "/test/audio". Default value None.

posix([path])

Converts path to POSIX format

posix_to_nt([path])

Converts posix formatted path to nt

shorten([path, part_count])

Shorten path into given parts length

size_bytes([path])

Total byte count of all files under given path.

size_string([path, show_bytes])

Total data size of all files under given path returned in human readable form.

Attributes

logger

Logger instance