diff options
author | Andrea Censi <acensi@ethz.ch> | 2022-02-26 12:40:14 +0100 |
---|---|---|
committer | Andrea Censi <acensi@ethz.ch> | 2022-02-26 12:40:14 +0100 |
commit | 5df248c0d5b67e1df4279f039384bb7e10423d4c (patch) | |
tree | b008e0588b95621167d3064bf37e8722e9d8d66b | |
parent | more comments (diff) | |
download | act4e-5df248c0d5b67e1df4279f039384bb7e10423d4c.tar.gz act4e-5df248c0d5b67e1df4279f039384bb7e10423d4c.zip |
more exercises
Diffstat (limited to '')
-rw-r--r-- | src/act4e_solutions/maps.py | 13 | ||||
-rw-r--r-- | src/act4e_solutions/posets_bounds.py | 8 | ||||
-rw-r--r-- | src/act4e_solutions/posets_construction.py | 14 | ||||
-rw-r--r-- | src/act4e_solutions/posets_interval.py | 18 | ||||
-rw-r--r-- | src/act4e_solutions/posets_sum.py | 9 | ||||
-rw-r--r-- | src/act4e_solutions/sets_power.py | 11 | ||||
-rw-r--r-- | src/act4e_solutions/sets_product.py | 15 | ||||
-rw-r--r-- | src/act4e_solutions/sets_properties.py | 14 | ||||
-rw-r--r-- | src/act4e_solutions/sets_sum.py | 15 | ||||
-rw-r--r-- | src/act4e_solutions/sets_union_inter.py | 11 |
10 files changed, 21 insertions, 107 deletions
diff --git a/src/act4e_solutions/maps.py b/src/act4e_solutions/maps.py index 8f161f4..aff881f 100644 --- a/src/act4e_solutions/maps.py +++ b/src/act4e_solutions/maps.py @@ -1,4 +1,4 @@ -from typing import overload, TypeVar +from typing import TypeVar import act4e_interfaces as I @@ -8,18 +8,9 @@ C = TypeVar("C") class SolFiniteMapOperations(I.FiniteMapOperations): - @overload - def identity(self, s: I.FiniteSet[A]) -> I.FiniteMap[A, A]: - ... # this is just a type declaration - do not implement - @overload def identity(self, s: I.Setoid[A]) -> I.Mapping[A, A]: - ... # this is just a type declaration - do not implement - - def identity(self, s: I.Setoid[A]) -> I.Mapping[A, A]: - raise NotImplementedError() # implement here - - # + raise NotImplementedError() def compose(self, f: I.FiniteMap[A, B], g: I.FiniteMap[B, C]) -> I.FiniteMap[A, C]: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_bounds.py b/src/act4e_solutions/posets_bounds.py index 99147cd..e1f9d26 100644 --- a/src/act4e_solutions/posets_bounds.py +++ b/src/act4e_solutions/posets_bounds.py @@ -14,15 +14,7 @@ class SolFinitePosetMeasurement(I.FinitePosetMeasurement): class SolFinitePosetConstructionOpposite(I.FinitePosetConstructionOpposite): - @overload def opposite(self, p: I.FinitePoset[X]) -> I.FinitePoset[X]: - ... # this is just a type declaration - do not implement - - @overload - def opposite(self, p: I.Poset[X]) -> I.Poset[X]: - ... # this is just a type declaration - do not implement - - def opposite(self, m: I.Poset[X]) -> I.Poset[X]: raise NotImplementedError() # implement here diff --git a/src/act4e_solutions/posets_construction.py b/src/act4e_solutions/posets_construction.py index ebcdec2..ae24f75 100644 --- a/src/act4e_solutions/posets_construction.py +++ b/src/act4e_solutions/posets_construction.py @@ -1,18 +1,10 @@ -from typing import Any, overload, TypeVar +from typing import Any, TypeVar import act4e_interfaces as I X = TypeVar("X") -class SolPosetConstructionPower(I.PosetConstructionPower): - @overload +class SolFinitePosetConstructionPower(I.FinitePosetConstructionPower): def powerposet(self, s: I.FiniteSet[X]) -> I.FinitePosetOfFiniteSubsets[X, Any]: - ... # this is just a type declaration - do not implement - - @overload - def powerposet(self, s: I.Setoid[X]) -> I.PosetOfFiniteSubsets[X, Any]: - ... # this is just a type declaration - do not implement - - def powerposet(self, s: I.Setoid[X]) -> I.PosetOfFiniteSubsets[X, Any]: - raise NotImplementedError() # implement here + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_interval.py b/src/act4e_solutions/posets_interval.py index 368de53..6047217 100644 --- a/src/act4e_solutions/posets_interval.py +++ b/src/act4e_solutions/posets_interval.py @@ -8,26 +8,10 @@ X = TypeVar("X") class SolFinitePosetConstructionTwisted(I.FinitePosetConstructionTwisted): - @overload def twisted(self, s: I.FinitePoset[X]) -> I.FinitePosetOfIntervals[X, Any]: - ... # this is just a type declaration - do not implement - - @overload - def twisted(self, s: I.Poset[X]) -> I.PosetOfIntervals[X, Any]: - ... # this is just a type declaration - do not implement - - def twisted(self, s: I.Poset[X]) -> I.PosetOfIntervals[X, Any]: - raise NotImplementedError() # implement here + raise NotImplementedError() class SolFinitePosetConstructionArrow(I.FinitePosetConstructionArrow): - @overload def arrow(self, s: I.FinitePoset[X]) -> I.FinitePosetOfIntervals[X, Any]: - ... # this is just a type declaration - do not implement - - @overload - def arrow(self, s: I.Poset[X]) -> I.PosetOfIntervals[X, Any]: - ... # this is just a type declaration - do not implement - - def arrow(self, s: I.Poset[X]) -> I.PosetOfIntervals[X, Any]: raise NotImplementedError() # implement here diff --git a/src/act4e_solutions/posets_sum.py b/src/act4e_solutions/posets_sum.py index 6d657e0..a797a14 100644 --- a/src/act4e_solutions/posets_sum.py +++ b/src/act4e_solutions/posets_sum.py @@ -6,13 +6,6 @@ X = TypeVar("X") class SolFinitePosetConstructionSum(I.FinitePosetConstructionSum): - @overload def disjoint_union(self, ps: Sequence[I.FinitePoset[X]]) -> I.FinitePosetDisjointUnion[X, Any]: - ... # this is just a type declaration - do not implement - - @overload - def disjoint_union(self, ps: Sequence[I.Poset[X]]) -> I.PosetDisjointUnion[X, Any]: - ... # this is just a type declaration - do not implement - - def disjoint_union(self, ps: Sequence[I.Poset[X]]) -> I.PosetDisjointUnion[X, Any]: raise NotImplementedError() # implement here + diff --git a/src/act4e_solutions/sets_power.py b/src/act4e_solutions/sets_power.py index 1969d86..49b4b7b 100644 --- a/src/act4e_solutions/sets_power.py +++ b/src/act4e_solutions/sets_power.py @@ -5,14 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class SolMakePowerSet(I.MakePowerSet): - @overload +class SolFiniteMakePowerSet(I.FiniteMakePowerSet): def powerset(self, s: I.FiniteSet[X]) -> I.FiniteSetOfFiniteSubsets[X, Any]: - ... # this is just a type declaration - do not implement - - @overload - def powerset(self, s: I.Setoid[X]) -> I.SetOfFiniteSubsets[X, Any]: - ... # this is just a type declaration - do not implement - - def powerset(self, s: I.Setoid[X]) -> I.SetOfFiniteSubsets[X, Any]: raise NotImplementedError() # implement here + diff --git a/src/act4e_solutions/sets_product.py b/src/act4e_solutions/sets_product.py index f81f3fe..bdba104 100644 --- a/src/act4e_solutions/sets_product.py +++ b/src/act4e_solutions/sets_product.py @@ -1,18 +1,11 @@ -from typing import Any, overload, Sequence, TypeVar +from typing import Any, Sequence, TypeVar import act4e_interfaces as I X = TypeVar("X") -class SolMakeSetProduct(I.MakeSetProduct): - @overload - def product(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetProduct[X, Any]: - ... # this is just a type declaration - do not implement - - @overload - def product(self, components: Sequence[I.Setoid[X]]) -> I.SetProduct[X, Any]: - ... # this is just a type declaration - do not implement +class SolFiniteMakeSetProduct(I.FiniteMakeSetProduct): - def product(self, components: Sequence[I.Setoid[X]]) -> I.SetProduct[X, Any]: - raise NotImplementedError() # implement here + def product(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetProduct[X, Any]: + raise NotImplementedError() # implement here diff --git a/src/act4e_solutions/sets_properties.py b/src/act4e_solutions/sets_properties.py index cca6de9..5390d23 100644 --- a/src/act4e_solutions/sets_properties.py +++ b/src/act4e_solutions/sets_properties.py @@ -10,19 +10,11 @@ class SolFiniteSetProperties(I.FiniteSetProperties): raise NotImplementedError() -class SolMakeSetUnion(I.MakeSetUnion): - @overload +class SolFiniteMakeSetUnion(I.FiniteMakeSetUnion): def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]: - ... + raise NotImplementedError() # implement here - @overload - def union(self, components: Sequence[I.EnumerableSet[X]]) -> I.EnumerableSetUnion[X, Any]: - ... - def union(self, components: Sequence[I.Setoid[X]]) -> I.SetUnion[X, Any]: - raise NotImplementedError() - - -class SolMakeSetIntersection(I.MakeSetIntersection): +class SolFiniteMakeSetIntersection(I.FiniteMakeSetIntersection): def intersection(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSet[X]: raise NotImplementedError() diff --git a/src/act4e_solutions/sets_sum.py b/src/act4e_solutions/sets_sum.py index 193a6a7..eab93d3 100644 --- a/src/act4e_solutions/sets_sum.py +++ b/src/act4e_solutions/sets_sum.py @@ -1,19 +1,10 @@ -from typing import Any, overload, Sequence, TypeVar +from typing import Any, Sequence, TypeVar import act4e_interfaces as I - X = TypeVar("X") -class SolMakeSetDisjointUnion(I.MakeSetDisjointUnion): - @overload +class SolFiniteMakeSetDisjointUnion(I.FiniteMakeSetDisjointUnion): def disjoint_union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetDisjointUnion[X, Any]: - ... # this is just a type declaration - do not implement - - @overload - def disjoint_union(self, components: Sequence[I.Setoid[X]]) -> I.SetDisjointUnion[X, Any]: - ... # this is just a type declaration - do not implement - - def disjoint_union(self, components: Sequence[I.Setoid[X]]) -> I.SetDisjointUnion[X, Any]: - raise NotImplementedError() # implement here + raise NotImplementedError() # implement here diff --git a/src/act4e_solutions/sets_union_inter.py b/src/act4e_solutions/sets_union_inter.py index edf9bd0..e70b2a9 100644 --- a/src/act4e_solutions/sets_union_inter.py +++ b/src/act4e_solutions/sets_union_inter.py @@ -5,16 +5,9 @@ import act4e_interfaces as I X = TypeVar("X") -class SolMakeSetUnion(I.MakeSetUnion): - @overload - def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]: - ... # this is just a type declaration - do not implement - - @overload - def union(self, components: Sequence[I.EnumerableSet[X]]) -> I.EnumerableSetUnion[X, Any]: - ... # this is just a type declaration - do not implement +class SolFiniteMakeSetUnion(I.FiniteMakeSetUnion): - def union(self, components: Sequence[I.EnumerableSet[X]]) -> I.EnumerableSetUnion[X, Any]: + def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]: raise NotImplementedError() # implement here |