tyche.references

This module contains functionality to represent references to concepts or roles. These references allow the value of concepts or roles to be fetched from individuals, and updated with new values within individuals.

exception tyche.references.TycheReferencesException(message)[source]

An exception type that is thrown when errors occur in the construction or use of references.

Parameters:

message (str) –

class tyche.references.SymbolReference(symbol)[source]

Bases: Generic[SymbolType]

Represents a reference to the value of a symbol.

Parameters:

symbol (str) –

class tyche.references.BakedSymbolReference(ref, obj)[source]

Bases: Generic[SymbolType]

Represents a reference to the value of a symbol, with the object that the value is accessed from baked in.

Parameters:
class tyche.references.FieldSymbolReference(symbol, *, field_name=None)[source]

Bases: Generic[SymbolType], SymbolReference[SymbolType]

Represents a reference to a field in an object.

Parameters:
  • symbol (str) –

  • field_name (Optional[str]) –

class tyche.references.FunctionSymbolReference(symbol, fget, fset=None)[source]

Bases: Generic[SymbolType], SymbolReference[SymbolType]

Represents a reference to a mutable property in an object.

Parameters:
  • symbol (str) –

  • fget (Callable[[object], SymbolType]) –

  • fset (Optional[Callable[[object, SymbolType], None]]) –

class tyche.references.GuardedSymbolReference(ref, get_transform, set_transform=None)[source]

Bases: Generic[SymbolType, GuardedSymbolType], SymbolReference[SymbolType]

Represents a mutable reference where the accessed value is different to the value stored in the reference. The referenced value is transformed when accessed or modified.

Parameters:
  • ref (SymbolReference[GuardedSymbolType]) –

  • get_transform (Callable[[GuardedSymbolType], SymbolType]) –

  • set_transform (Optional[Callable[[SymbolType], GuardedSymbolType]]) –