GraphImporter#

class eclypse.io.base.GraphImporter[source]#

Bases: ABC, Generic[TGraph, TData]

Base class for graph importers.

Importers read a source into an intermediate data representation, then build an ECLYPSE graph object from that representation. Subclasses normally implement read_data() and from_data().

Methods

from_data(data, *[, kind, context])

Convert importer data into a graph object.

load(source, *[, kind, context])

Import a graph object from the provided source.

read_data(source, *[, context])

Read importer data from a source.

load(source, *, kind=None, context=None)[source]#

Import a graph object from the provided source.

Parameters:
  • source (str | Path) – The source path to read.

  • kind (GraphKind | None) – Optional graph kind requested by the caller.

  • context (IOContext | None) – Optional import/export customisation.

Returns:

The imported graph object.

Return type:

TGraph

abstractmethod read_data(source, *, context=None)[source]#

Read importer data from a source.

Parameters:
  • source (str | Path) – The source path to read.

  • context (IOContext | None) – Optional import/export customisation.

Returns:

The intermediate representation handled by from_data().

Return type:

TData

abstractmethod from_data(data, *, kind=None, context=None)[source]#

Convert importer data into a graph object.

Parameters:
  • data (TData) – The intermediate representation to convert.

  • kind (GraphKind | None) – Optional graph kind requested by the caller.

  • context (IOContext | None) – Optional import/export customisation.

Returns:

The imported graph object.

Return type:

TGraph