summaryrefslogtreecommitdiffstats
path: root/src/act4e_solutions
diff options
context:
space:
mode:
Diffstat (limited to 'src/act4e_solutions')
-rw-r--r--src/act4e_solutions/semicategory_representation.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/act4e_solutions/semicategory_representation.py b/src/act4e_solutions/semicategory_representation.py
index 9012c4f..4ab9909 100644
--- a/src/act4e_solutions/semicategory_representation.py
+++ b/src/act4e_solutions/semicategory_representation.py
@@ -37,10 +37,13 @@ class MySemiCategory(Generic[OD, MD], I.SemiCategory[ROD, RMD]):
def add_object(self, ob: ROD):
self._objects[ob.label] = ob
+ def get_object(self, label: str):
+ return self._objects[label]
+
def add_morphism(self, source: str, target: str, mor: RMD):
if not (source, target) in self._morphisms[0].keys():
self._morphisms[0][source, target] = []
- self._morphisms[0][(source, target)].append(mor)
+ self._morphisms[0][source, target].append(mor)
def objects(self, uptolevel: Optional[int] = None) -> EnumerableSet[ROD]:
return MyFiniteSet(self._objects.values())
@@ -100,7 +103,7 @@ class MySemiCategory(Generic[OD, MD], I.SemiCategory[ROD, RMD]):
return morphisms
- morphisms = all_morphisms(ob1.label, ob2.label, uptolevel)
+ morphisms = all_morphisms(ob1.label, ob2.label, uptolevel or 0)
return MyFiniteSet(morphisms)
def compose(self, ob1: ROD, ob2: ROD, ob3: ROD, m1: RMD, m2: RMD) -> RMD: