diff options
author | Nao Pross <np@0hm.ch> | 2023-11-16 22:29:09 +0100 |
---|---|---|
committer | Nao Pross <np@0hm.ch> | 2023-11-16 22:29:09 +0100 |
commit | 14b134e942b18dcf3955c4a5f690774497b92911 (patch) | |
tree | dff549235a064b89b4c17e95d43b028ce88d4143 /src | |
parent | Remove unused Morph and Obj, use equations (diff) | |
download | act4e-14b134e942b18dcf3955c4a5f690774497b92911.tar.gz act4e-14b134e942b18dcf3955c4a5f690774497b92911.zip |
Fix bug when uptolevel is None
Diffstat (limited to 'src')
-rw-r--r-- | src/act4e_solutions/semicategory_representation.py | 7 |
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: |