util.persistence.serializeJSON module

Inheritance diagram of JSONSerializationStrategy

class util.persistence.serializeJSON.JSONSerializationStrategy

Bases: SerializationStrategy

The SerializationStrategy for JSON files.

classmethod defaultExtension() → str
Returns:

Return type:

str

classmethod sniff(start: bytes) → int
Returns:

1 if start looks like JSON (a table or a list).

classmethod protocolName() → str
Returns:

Return type:

str

classmethod protocolVersion() → str
Returns:

Return type:

str

_tostring(elem: dict | list | int | float | bool | str, kwargs: dict[str, Any]) → str
Parameters:
  • elem (JSONtypes)

  • kwargs (dict[str, Any])

Returns:

Return type:

str

_fromstring(string: str, kwargs: dict[str, Any]) → dict | list | int | float | bool | str
Parameters:
  • string (str)

  • kwargs (dict[str, Any])

Returns:

Return type:

JSONtypes

_encodeStr(obj: str) → dict | list | int | float | bool | str
Parameters:

obj (str)

Returns:

Return type:

JSONtypes

_decodeStr(elem: dict | list | int | float | bool | str) → str
Parameters:

elem (JSONtypes)

Returns:

Return type:

str

_encodeInt(obj: int) → dict | list | int | float | bool | str
Parameters:

obj (int)

Returns:

Return type:

JSONtypes

_decodeInt(elem: dict | list | int | float | bool | str) → int
Parameters:

elem (JSONtypes)

Returns:

Return type:

int

_encodeFloat(obj: float) → dict | list | int | float | bool | str
Parameters:

obj (float)

Returns:

Return type:

JSONtypes

_decodeFloat(elem: dict | list | int | float | bool | str) → float
Parameters:

elem (JSONtypes)

Returns:

Return type:

float

_encodeBool(obj: bool) → dict | list | int | float | bool | str
Parameters:

obj (bool)

Returns:

Return type:

JSONtypes

_decodeBool(elem: dict | list | int | float | bool | str) → bool
Parameters:

elem (JSONtypes)

Returns:

Return type:

bool

_encodeList() → dict | list | int | float | bool | str
Returns:

Return type:

JSONtypes

_decodeList(elem: dict | list | int | float | bool | str) → list[dict | list | int | float | bool | str]
Parameters:

elem (JSONtypes)

Returns:

Return type:

list[JSONtypes]

_encodeStrdict() → dict | list | int | float | bool | str
Returns:

Return type:

JSONtypes

_decodeStrdict(elem: dict | list | int | float | bool | str) → dict[str, dict | list | int | float | bool | str]
Parameters:

elem (JSONtypes)

Returns:

Return type:

dict[str, JSONtypes]

_setAttr(elem: dict | list | int | float | bool | str, name: str, value: str) → None
Parameters:
  • elem (JSONtypes)

  • name (str)

  • value (str)

_getAttr(elem: dict | list | int | float | bool | str, name: str, default: Any = <class 'KeyError'>) → Any
Parameters:
  • elem (JSONtypes)

  • name (str)

  • default (Any)

Returns:

Return type:

Any

_setKVPair(elem: dict | list | int | float | bool | str, key: dict | list | int | float | bool | str, value: dict | list | int | float | bool | str) → None
Parameters:
  • elem (JSONtypes)

  • key (JSONtypes)

  • value (JSONtypes)

_getKVPairs(elem: dict | list | int | float | bool | str) → list[tuple[dict | list | int | float | bool | str, dict | list | int | float | bool | str]] | dict[str, dict | list | int | float | bool | str]
Parameters:

elem (JSONtypes)

Returns:

Return type:

list[tuple[JSONtypes, JSONtypes]] | dict[str, JSONtypes]

_appendItem(elem: dict | list | int | float | bool | str, newItem: dict | list | int | float | bool | str) → None
Parameters:
  • elem (JSONtypes)

  • newItem (JSONtypes)

_getItems(elem: dict | list | int | float | bool | str) → list[dict | list | int | float | bool | str]
Parameters:

elem (JSONtypes)

Returns:

Return type:

list[JSONtypes]

_abc_impl = <_abc._abc_data object>