Context

The galactic.algebras.context module defines classes for creating context.

class galactic.algebras.context.Context(renderer: galactic.algebras.context.main.ContextRenderer = <galactic.algebras.context.main.ContextRenderer object>)

Bases: collections.abc.Set

The Context class represents a binary relation between 2 sets.

abstract objects() → Iterator[Any]

The objects() method returns an iterator overs the objects.

Returns

An iterator over the objects

Return type

Iterator[_G]

abstract attributes() → Iterator[Any]

The attributes() method returns an iterator overs the attributes.

Returns

An iterator over the attributes

Return type

Iterator[_M]

class galactic.algebras.context.ContextRenderer

Bases: object

The ContextRenderer class is used to render a context for jupyter notebook.

row(obj: Any, _context: galactic.algebras.context.main.Context)str

Render an object into the header.

Parameters
  • obj (Any) – The object to render

  • context (Context) – The underlying context

Returns

The string representation of the object into a row.

Return type

str

header(attribute: Any, _context: galactic.algebras.context.main.Context)str

Render an attribute into the header.

Parameters
  • attribute (Any) – The attribute to render

  • context (Context) – The underlying context

Returns

The string representation of the attribute into the header.

Return type

str