๐Ÿ”Œ Application Programming Interface

๐Ÿ”Œ Application Programming Interface#

YAML Data reader.

class YAMLDataReader#

Bases: object

YAML Data reader.

Example

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

Get an iterator over the supported extensions.

Returns:

An iterator over the supported extensions

Return type:

Iterator[str]

classmethod read(data_file)#

Read a YAML data file.

Parameters:

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

Returns:

The data.

Return type:

Mapping[str, object]

register()#

Register an instance of a yaml data reader.

Return type:

None