🔌 Application Programming Interface

🔌 Application Programming Interface#

SLF Data reader.

class SLFDataReader#

Bases: object

̀`SLF`` Data reader.

Example

>>> from pprint import pprint
>>> from galactic.io.data.slf import SLFDataReader
>>> reader = SLFDataReader()
>>> import io
>>> data = '''
... [Lattice]
... 2
... 3
... [Objects]
... 1 2
... [Attributes]
... a b c
... [Relation]
... 0 1 0
... 1 1 0
... '''.strip()
>>> individuals = reader.read(io.StringIO(data))
>>> pprint({key: sorted(list(value)) for key, value in individuals.items()})
{'1': ['b'], '2': ['a', 'b']}
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 SLF data file.

Parameters:

data_file (TextIO) – A readable text file.

Returns:

The data.

Return type:

Mapping[str, object]

register()#

Register an instance of a SLF data reader.

Return type:

None