bob.io.File¶
-
class
bob.io.File((object)arg1, (str)filename, (str)mode) → object :¶ Bases:
Boost.Python.instanceAbstract base class for all Array/Arrayset i/o operations
Opens a (supported) file for reading arrays. The mode is a single character which takes one of the following values: ‘r’ - opens the file for read-only operations; ‘w’ - truncates the file and open it for reading and writing; ‘a’ - opens the file for reading and writing w/o truncating it.
- __init__( (object)arg1, (str)filename, (str)mode, (str)pretend_extension) -> object :
- Opens a (supported) file for reading arrays but pretends its extension is as given by the last parameter - this way you can, potentially, override the default encoder/decoder used to read and write on the file. The mode is a single character which takes one of the following values: ‘r’ - opens the file for read-only operations; ‘w’ - truncates the file and open it for reading and writing; ‘a’ - opens the file for reading and writing w/o truncating it.
-
__init__((object)arg1, (str)filename, (str)mode) → object :¶ Opens a (supported) file for reading arrays. The mode is a single character which takes one of the following values: ‘r’ - opens the file for read-only operations; ‘w’ - truncates the file and open it for reading and writing; ‘a’ - opens the file for reading and writing w/o truncating it.
- __init__( (object)arg1, (str)filename, (str)mode, (str)pretend_extension) -> object :
- Opens a (supported) file for reading arrays but pretends its extension is as given by the last parameter - this way you can, potentially, override the default encoder/decoder used to read and write on the file. The mode is a single character which takes one of the following values: ‘r’ - opens the file for read-only operations; ‘w’ - truncates the file and open it for reading and writing; ‘a’ - opens the file for reading and writing w/o truncating it.
Methods
__init__((object)arg1, (str)filename, (str)mode)Opens a (supported) file for reading arrays. append((File)self, (object)array)Appends an array to a file. read((File)self)Reads the whole contents of the file into a NumPy ndarray write((File)self, (object)array)Writes an array into the file, truncating it first Attributes
codec_nameName of the File class implementation – for compatibility reasons with the previous versions of this library filenameThe path to the file being read/written typeTyping information to load the file as an Arrayset type_allTyping information to load all of the file at once -
append((File)self, (object)array) → None :¶ Appends an array to a file. Compatibility requirements may be enforced.
-
codec_name¶ Name of the File class implementation – for compatibility reasons with the previous versions of this library
-
filename¶ The path to the file being read/written
-
read((File)self) → object :¶ Reads the whole contents of the file into a NumPy ndarray
- read( (File)self, (int)index) -> object :
- Reads a single array from the file considering it to be an arrayset list
-
type¶ Typing information to load the file as an Arrayset
-
type_all¶ Typing information to load all of the file at once
-
write((File)self, (object)array) → None :¶ Writes an array into the file, truncating it first