๐Ÿ”Œ Application Programming Interface

๐Ÿ”Œ Application Programming Interface#

galactic.io.data.yaml module

Class


class YAMLDataReader#

Bases: object

YAML Data reader.

Example

>>> from pprint import pprint
>>> from galactic.io.data.yaml import YAMLDataReader
>>> reader = YAMLDataReader()
>>> import io
>>> text = '''# This is a YAML document.
... - firstname: ร‰variste
...   name: Galois
... - firstname: Rudolf
...   name: Wille
... '''
>>> data = reader.read(io.StringIO(text))
>>> pprint(data)
[frozendict.frozendict({'firstname': 'ร‰variste', 'name': 'Galois'}),
 frozendict.frozendict({'firstname': 'Rudolf', 'name': 'Wille'})]
extensions()#

Get an iterator over the supported extensions.

Returns:

An iterator over the supported extensions

Return type:

Iterator[str]

read(data_file)#

Read a YAML data file.

Parameters:

data_file (TextIO) โ€“ A readable text file.

Returns:

The data.

Return type:

Data

register()#

Register an instance of a YAML data reader.

Return type:

None