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:

IoException

blocking_load()#

Blocking load.

Returns:

dict. File representation as dict.

Raises:

IoException

abstract copy()#

Return a copy.

abstract dump(data: dict)#

Dump.

Parameters:

data (dict) – Dictionary to dump.

Raises:

IoException

static get_io(path)#

Return io object by path.

Parameters:

path (pathlib.Path) – Path

Returns:

Io class by this path.

Raises:
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:

IoException

property path#

Path to file.

Raises:

TypeError

Type:

pathlib.Path

exception spmi.utils.io.io.IoException#

Bases: SpmiException

Module contents#