From f04d6d2e90e962552de80a4e7b5a45e9f4080c71 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 18 Nov 2023 11:33:06 +0100 Subject: Fix semicategory loading --- src/act4e_solutions/semicategory_representation.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/act4e_solutions') diff --git a/src/act4e_solutions/semicategory_representation.py b/src/act4e_solutions/semicategory_representation.py index 4ab9909..dd82485 100644 --- a/src/act4e_solutions/semicategory_representation.py +++ b/src/act4e_solutions/semicategory_representation.py @@ -107,8 +107,9 @@ class MySemiCategory(Generic[OD, MD], I.SemiCategory[ROD, RMD]): return MyFiniteSet(morphisms) def compose(self, ob1: ROD, ob2: ROD, ob3: ROD, m1: RMD, m2: RMD) -> RMD: - m3 = self._composition(ob1.obdata, ob2.obdata, ob3.obdata, m1.mordata, m2.mordata) - return I.RichMorphism(";".join((m1.label, m2.label)), m3) + m3data = self._composition(ob1.obdata, ob2.obdata, ob3.obdata, m1.mordata, m2.mordata) + m3 = I.RichMorphism(";".join((m1.label, m2.label)), m3data) + return m3 def identity(self, ob: ROD) -> RMD: if not self._objects[ob.label]: @@ -142,10 +143,10 @@ class SolSemiCategoryRepresentation(I.SemiCategoryRepresentation): raise I.InvalidFormat() if "identity" in ob.keys() and ob["identity"]: - identity = I.RichMorphism(f"id_{obname}", ob["identity"]["mordata"]) + identity = I.RichMorphism(f"id_{obname}", MorData.load(h, ob["identity"]["mordata"])) sc.add_morphism(obname, obname, identity) - sc.add_object(I.RichObject(obname, ob["obdata"])) + sc.add_object(I.RichObject(obname, ObData.load(h, ob["obdata"]))) # Get the morphisms for morname, mor in data["morphisms"].items(): @@ -153,6 +154,7 @@ class SolSemiCategoryRepresentation(I.SemiCategoryRepresentation): raise I.InvalidFormat() src, tar = mor["source"], mor["target"] - sc.add_morphism(mor["source"], mor["target"], I.RichMorphism(morname, mor["mordata"])) + morphism = I.RichMorphism(morname, MorData.load(h, mor["mordata"])) + sc.add_morphism(mor["source"], mor["target"], morphism) return sc -- cgit v1.2.1