diff --git a/bob/io/base/__init__.py b/bob/io/base/__init__.py index cc2119a362b5e64087b5a53858551e2bb9f20f4a..71dbc365c21a2f0faac7b906ed280ad1e409388e 100644 --- a/bob/io/base/__init__.py +++ b/bob/io/base/__init__.py @@ -24,7 +24,7 @@ def __is_string__(s): return (version_info[0] < 3 and isinstance(s, (str, unicode))) or \ isinstance(s, (bytes, str)) -def create_directories_save(directory, dryrun=False): +def create_directories_safe(directory, dryrun=False): """Creates a directory if it does not exists, with concurrent access support. This function will also create any parent directories that might be required. If the dryrun option is selected, it does not actually create the directory, @@ -138,12 +138,13 @@ def save(array, filename, create_directories = False): """ # create directory if not existent yet if create_directories: - create_directories_save(os.path.dirname(filename)) + create_directories_safe(os.path.dirname(filename)) return File(filename, 'w').write(array) # Just to make it homogenous with the C++ API write = save +read = load def append(array, filename): """Appends the contents of an array-like object to file. diff --git a/bob/io/base/hdf5.cpp b/bob/io/base/hdf5.cpp index dcb4249cc61a7f6f67c1c0cc32a360ca7b805a25..0eec57afcf4730a3b141eb91b85f83c1d5bc4756 100644 --- a/bob/io/base/hdf5.cpp +++ b/bob/io/base/hdf5.cpp @@ -2546,6 +2546,12 @@ static PyMethodDef PyBobIoHDF5File_Methods[] = { METH_VARARGS|METH_KEYWORDS, s_read_doc, }, + { + "get", + (PyCFunction)PyBobIoHDF5File_Read, + METH_VARARGS|METH_KEYWORDS, + s_read_doc, + }, { s_lread_str, (PyCFunction)PyBobIoHDF5File_ListRead, @@ -2570,6 +2576,12 @@ static PyMethodDef PyBobIoHDF5File_Methods[] = { METH_VARARGS|METH_KEYWORDS, s_set_doc, }, + { + "write", + (PyCFunction)PyBobIoHDF5File_Set, + METH_VARARGS|METH_KEYWORDS, + s_set_doc, + }, { s_copy_str, (PyCFunction)PyBobIoHDF5File_Copy,