dcase_util.containers.DictContainer
- class dcase_util.containers.DictContainer(*args, **kwargs)[source]
Dictionary container class inherited from standard dict class.
Methods
__init__
(*args, **kwargs)clear
()copy
()delimiter
([exclude_delimiters])Use csv.sniffer to guess delimiter for CSV file
detect_file_format
([filename])Detect file format from extension
empty
()Check if file is empty
exists
()Checks that file exists
filter
([data, excluded_key_prefix])Filter nested dict
fromkeys
(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get
(key[, default])Return the value for key if key is in the dictionary, else default.
get_dump_content
(data)Clean internal content for saving
get_file_information
()Get file information, filename
get_hash
([data])Get unique hash string (md5) for given parameter dict.
get_hash_for_path
([dotted_path])Get unique hash string for the data under given path.
get_leaf_path_list
([target_field, ...])Get path list to all leaf node in the nested dict.
get_path
(path[, default, data])Get value from nested dict with dotted path
is_package
([filename])Determine if the file is compressed package.
items
()keys
()load
([filename, file_format])Load file
log
([level])Log container content
merge
(override[, target])Recursive dict merge
pop
(key[, default])If key is not found, default is returned if given, otherwise KeyError is raised
popitem
(/)Remove and return a (key, value) pair as a 2-tuple.
save
([filename, file_format])Save file
set_path
(path, new_value[, data])Set value in nested dict with dotted path
setdefault
(key[, default])Insert key with a value of default if key is not in the dictionary.
show
([mode, indent, visualize])Print container content
to_html
([indent])Get container information in a HTML formatted string
to_string
([ui, indent])Get container information in a string
update
([E, ]**F)If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
validate_format
()Validate file format
values
()Attributes
bytes
File size in bytes
logger
Logger instance
md5
Checksum for file.
valid_formats
Valid file formats