spmi.utils.io package#
Subpackages#
Submodules#
spmi.utils.io.io module#
Provides Io.
- class spmi.utils.io.io.Io(path)#
Bases:
objectFormatted input and output.
Each realisation of this class can load single file extention and defined in
iospackage in single file. Class and file name are based on file extention format.For example,
ios.jsonio.Jsoncan load only.jsonfiles.- 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:
Ioclass by this path.- Raises:
TypeError –
- static has_io(suffix)#
Returns
Trueif 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