🔌 Application Programming Interface

🔌 Application Programming Interface#

galactic.io.data.slf module

Class


class SLFDataReader#

Bases: object

Ì€`SLF`` Data reader.

Example

>>> from pprint import pprint
>>> from galactic.io.data.slf import SLFDataReader
>>> reader = SLFDataReader()
>>> import io
>>> text = '''
... [Lattice]
... 2
... 3
... [Objects]
... 1 2
... [Attributes]
... a b c
... [Relation]
... 0 1 0
... 1 1 0
... '''.strip()
>>> dataset = reader.read(io.StringIO(text))
>>> pprint({key: dict(data) for key, data in dataset.items()})
{'1': {'a': False, 'b': True, 'c': False},
 '2': {'a': True, 'b': True, 'c': False}}
extensions()#

Return an iterator over the supported file extensions.

Returns:

An iterator over the supported file extensions

Return type:

Iterator[str]

read(data_file)#

Read an SLF data file.

Parameters:

data_file (TextIO) – A readable text file

Returns:

The data set read from the file

Return type:

DataSet

register()#

Register an instance of an SLF data reader.

Return type:

None