🔌 Application Programming Interface

🔌 Application Programming Interface#

FIMI Data reader.

class FIMIDataReader#

Bases: object

FIMI Data reader.

Example

>>> from pprint import pprint
>>> from galactic.io.data.fimi import FIMIDataReader
>>> reader = FIMIDataReader()
>>> import io
>>> data = '''
... 1 3
... 2 4 5
... 1 2
... 3 4 5
... '''.strip()
>>> individuals = reader.read(io.StringIO(data))
>>> pprint({key: list(sorted(value)) for key, value in individuals.items()})
{'0': ['1', '3'], '1': ['2', '4', '5'], '2': ['1', '2'], '3': ['3', '4', '5']}
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 FIMI data file.

Parameters:

data_file (TextIO) – A readable text file.

Returns:

The data.

Return type:

Mapping[str, object]

register()#

Register an instance of a FIMI data reader.

Return type:

None