spmi.utils.io package#
Subpackages#
Submodules#
spmi.utils.io.io module#
Provides Io
.
- class spmi.utils.io.io.Io(path)#
Bases:
object
Formatted input and output.
Each realisation of this class can load single file extention and defined in
ios
package in single file. Class and file name are based on file extention format.For example,
ios.jsonio.Json
can load only.json
files.- Parameters:
path (
pathlib.Path
) – Path to file.- Raises:
TypeError –
- blocking_dump(data)#
Blocking dump.
- Parameters:
data (
dict
) – Dictionary to dump.- Raises:
- blocking_load()#
Blocking load.
- Returns:
dict
. File representation as dict.- Raises:
- abstract copy()#
Return a copy.
- abstract dump(data: dict)#
Dump.
- Parameters:
data (
dict
) – Dictionary to dump.- Raises:
- static get_io(path)#
Return io object by path.
- Parameters:
path (
pathlib.Path
) – Path- Returns:
Io
class by this path.- Raises:
TypeError –
- static has_io(suffix)#
Returns
True
if has loader for file with suffix.- Parameters:
suffix (
str
) – Suffix.- Returns:
bool
.- Raises:
TypeError –
ValueError –
- abstract load()#
Load.
- Returns:
dict
. File representation as dict.- Raises:
- property path#
Path to file.
- Raises:
TypeError –
- Type:
pathlib.Path
- exception spmi.utils.io.io.IoException#
Bases:
SpmiException