csb43.formats

csb43.formats.DICT_FORMATS = ['json', 'yaml']

dictionary formats

csb43.formats.FORMATS = ['latex', 'yaml', 'ods', 'xlsx', 'xls', 'dbf', 'tsv', 'html', 'csv', 'json']

available formats

csb43.formats.TABLIB_FORMATS = ['json', 'xls', 'yaml', 'csv', 'dbf', 'tsv', 'html', 'latex', 'xlsx', 'ods']

formats supported by tablib

csb43.formats.convertFromCsb(csb, expectedFormat)

Convert a File file into an tablib data object or a dictionary-like object

Parameters:csb (csb43.csb43.File) – a csb file
Return type:tablib.Databook, tablib.Dataset or a object with an attribute named as expectedFormat
csb43.formats.convertFromCsb2Dict(csb, expectedFormat='json')

Convert from CSB43 to a dictionary format

Parameters:csb (csb43.csb43.File) – a csb file
Return type:a object with an attribute named as expectedFormat
Raises:csb43.utils.Csb43Exception when the format is unknown or unsupported
>>> from csb43.csb43 import File
>>> import csb43.formats as formats
>>> f = File()
>>> o = formats.convertFromCsb2Dict(f, 'yaml')
>>> print o.yaml
cuentas: []
>>> o = formats.convertFromCsb2Dict(f, 'json')
>>> print o.json
{"cuentas": []}
csb43.formats.convertFromCsb2Tabular(csb, expectedFormat='ods')

Convert a File file into an tablib data object

Parameters:csb (csb43.csb43.File) – a csb file
Return type:tablib.Databook or tablib.Dataset
formats.FORMATS = ['latex', 'yaml', 'ods', 'xlsx', 'xls', 'dbf', 'tsv', 'html', 'csv', 'json']
formats.TABLIB_FORMATS = ['json', 'xls', 'yaml', 'csv', 'dbf', 'tsv', 'html', 'latex', 'xlsx', 'ods']
formats.DICT_FORMATS = ['json', 'yaml']
csb43.formats.convertFromCsb(csb, expectedFormat)

Convert a File file into an tablib data object or a dictionary-like object

Parameters:csb (csb43.csb43.File) – a csb file
Return type:tablib.Databook, tablib.Dataset or a object with an attribute named as expectedFormat
csb43.formats.convertFromCsb2Dict(csb, expectedFormat='json')

Convert from CSB43 to a dictionary format

Parameters:csb (csb43.csb43.File) – a csb file
Return type:a object with an attribute named as expectedFormat
Raises:csb43.utils.Csb43Exception when the format is unknown or unsupported
>>> from csb43.csb43 import File
>>> import csb43.formats as formats
>>> f = File()
>>> o = formats.convertFromCsb2Dict(f, 'yaml')
>>> print o.yaml
cuentas: []
>>> o = formats.convertFromCsb2Dict(f, 'json')
>>> print o.json
{"cuentas": []}
csb43.formats.convertFromCsb2Tabular(csb, expectedFormat='ods')

Convert a File file into an tablib data object

Parameters:csb (csb43.csb43.File) – a csb file
Return type:tablib.Databook or tablib.Dataset