From 09c136f6f3cde7ed6a750dec0ac73fcec03e9472 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Sat, 20 Feb 2021 15:49:00 +0100 Subject: First --- Dockerfile | 17 +++++++++++++++++ Makefile | 21 +++++++++++++++++++++ requirements.txt | 0 setup.py | 10 ++++++++++ src/act4e_solutions/__init__.py | 0 5 files changed, 48 insertions(+) create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 requirements.txt create mode 100644 setup.py create mode 100644 src/act4e_solutions/__init__.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0adfd96 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM andreacensi/act4e:spring2021 + +WORKDIR /ACT4E + +COPY requirements.txt . +RUN pip install -r requirements.txt + +COPY src src +COPY setup.py . + + +#RUN git clone --branch spring2021 https://github.com/idsc-frazzoli/ACT4E-exercises.git +#RUN cd ACT4E-exercises && python setup.py develop + + +RUN python setup.py develop + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..51c3aa6 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +all: + +tag=mytag + +pull: + docker pull andreacensi/act4e:spring2021 + +build: + docker build -t $(tag) . + + +check: build + docker run -it --rm $(tag) act4e-tests --module act4e_solutions + + +check-%: build + docker run -it --rm $(tag) act4e-tests --module act4e_solutions --group $* + +# +#check: +# docker run -it --rm -v $(PWD):$(PWD):ro -w $(PWD) andreacensi/act4e:spring2021 act4e-tests --module act4e_solutions diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..e64c8cc --- /dev/null +++ b/setup.py @@ -0,0 +1,10 @@ +from setuptools import find_packages, setup + +setup(name='ACT4E-MySolutions', + version="0.1", + package_dir={'': 'src'}, + packages=find_packages('src'), + entry_points={ + }, + extras_require={}, + ) diff --git a/src/act4e_solutions/__init__.py b/src/act4e_solutions/__init__.py new file mode 100644 index 0000000..e69de29 -- cgit v1.2.1 From 7ca1957d7539be03f9a93701278288bce488944c Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Sun, 21 Feb 2021 14:16:19 +0100 Subject: fix --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 51c3aa6..eb3bfd6 100644 --- a/Makefile +++ b/Makefile @@ -3,18 +3,18 @@ all: tag=mytag pull: - docker pull andreacensi/act4e:spring2021 + docker pull andreacensi/act4e:spring2021 build: docker build -t $(tag) . check: build - docker run -it --rm $(tag) act4e-tests --module act4e_solutions + docker run --rm $(tag) act4e-tests --module act4e_solutions check-%: build - docker run -it --rm $(tag) act4e-tests --module act4e_solutions --group $* + docker run --rm $(tag) act4e-tests --module act4e_solutions --group $* # #check: -- cgit v1.2.1 From 68db9a00070a6926e947a64d76bf20289c2014f9 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Thu, 4 Mar 2021 15:48:57 +0100 Subject: fix --- Makefile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index eb3bfd6..037ff7a 100644 --- a/Makefile +++ b/Makefile @@ -5,17 +5,14 @@ tag=mytag pull: docker pull andreacensi/act4e:spring2021 -build: +build: pull docker build -t $(tag) . check: build - docker run --rm $(tag) act4e-tests --module act4e_solutions + docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) act4e-tests --module act4e_solutions check-%: build - docker run --rm $(tag) act4e-tests --module act4e_solutions --group $* + docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) act4e-tests --module act4e_solutions --group $* -# -#check: -# docker run -it --rm -v $(PWD):$(PWD):ro -w $(PWD) andreacensi/act4e:spring2021 act4e-tests --module act4e_solutions -- cgit v1.2.1 From c06e3e7a8477dde3d204ea4f21ee6735d4af082e Mon Sep 17 00:00:00 2001 From: JonathanLorand Date: Tue, 6 Apr 2021 18:54:06 +0200 Subject: added .DS_Store to gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9bea433 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +.DS_Store -- cgit v1.2.1 From 5b55bee81374fca9f4498716a065070cd0303ce4 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Tue, 14 Sep 2021 07:46:29 +0200 Subject: Bump to version 7.1.2104061654 --- setup.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 setup.json diff --git a/setup.json b/setup.json new file mode 100644 index 0000000..38bb472 --- /dev/null +++ b/setup.json @@ -0,0 +1,18 @@ +{ + "install_requires": [], + "tests_require": [], + "srcdir": "src", + "package_name": "ACT4E-MySolutions", + "entry_points": { + "console_scripts": [] + }, + "zip_safe": true, + "include_package_data": true, + "modules": [ + "act4e_solutions" + ], + "version": "7.1.2104061654", + "author": "", + "author_email": "", + "url": "" +} \ No newline at end of file -- cgit v1.2.1 From 3c9abcd978bb07c00f95811782c609b6eb613207 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Wed, 29 Sep 2021 14:10:36 +0200 Subject: misc --- Dockerfile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0adfd96..52b3b92 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,15 +3,10 @@ FROM andreacensi/act4e:spring2021 WORKDIR /ACT4E COPY requirements.txt . -RUN pip install -r requirements.txt +RUN python3 -m pip install -r requirements.txt COPY src src COPY setup.py . - -#RUN git clone --branch spring2021 https://github.com/idsc-frazzoli/ACT4E-exercises.git -#RUN cd ACT4E-exercises && python setup.py develop - - -RUN python setup.py develop +RUN python3 -m pip install -e . -- cgit v1.2.1 From 760ceaabae8b497f80dd4a2ca6c7dedfe3b6ed10 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Wed, 29 Sep 2021 14:10:44 +0200 Subject: Bump to version 7.1.2109291210 --- setup.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.json b/setup.json index 38bb472..2a1d82e 100644 --- a/setup.json +++ b/setup.json @@ -11,7 +11,7 @@ "modules": [ "act4e_solutions" ], - "version": "7.1.2104061654", + "version": "7.1.2109291210", "author": "", "author_email": "", "url": "" -- cgit v1.2.1 From acedfaf03470cc2b69bb0ffd7d30a38c97c2309c Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Fri, 15 Oct 2021 17:56:23 +0200 Subject: fix --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 52b3b92..8377abd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM andreacensi/act4e:spring2021 +FROM docker.io/andreacensi/act4e:spring2021 WORKDIR /ACT4E -- cgit v1.2.1 From 77eb801c3d8b1c003765c27a46168af80a82d088 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Fri, 15 Oct 2021 17:56:56 +0200 Subject: Bump to version 7.1.2110151556 --- setup.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.json b/setup.json index 2a1d82e..94883dc 100644 --- a/setup.json +++ b/setup.json @@ -11,7 +11,7 @@ "modules": [ "act4e_solutions" ], - "version": "7.1.2109291210", + "version": "7.1.2110151556", "author": "", "author_email": "", "url": "" -- cgit v1.2.1 From da27223101363053a496e26842ade1432ddcd6c8 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Fri, 15 Oct 2021 23:34:01 +0200 Subject: templates --- .pre-commit-config.yaml | 42 ++++++++++++++++++++++++++++++++++++++++++ MANIFEST.in | 23 +++++++++++++++++++++++ setup.json | 2 +- 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-config.yaml create mode 100644 MANIFEST.in diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..d373e7a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,42 @@ +--- +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.4.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-merge-conflict + - id: check-symlinks +# - id: trailing-whitespace +# - id: end-of-file-fixer +# - id: check-yaml +# - id: check-json +# - id: check-docstring-first +# - id: flake8 +# args: [--max-line-length=100] +- repo: https://github.com/psf/black + rev: 20.8b1 + hooks: + - id: black + language_version: python3.8 + args: [-l, '110'] +#- repo: https://github.com/adrienverge/yamllint.git +# rev: v1.26.1 # or higher tag +# hooks: +# - id: yamllint +# args: [--format, parsable] +- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 0.1.0 # or specific tag + hooks: + - id: yamlfmt + args: [--mapping, '2', --sequence, '2', --offset, '0', --width, '150', --preserve-quotes] + +# args: [--mapping, '2', --sequence, '0', --offset, '0', --width, '150'] + + +#exclude: .bumpversion.cfg + +files: (^src/.*py)|(.*yaml) + +# sigil 3d9109598d23dfbb339c65e4dae064bd diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..dc1dc93 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,23 @@ +#@ These are autogenerated. Add local stuff in the next section. + +include setup.json +exclude project.pp1.yaml +exclude Makefile* +exclude Dockerfile* +exclude *.mk +exclude requirements*txt +exclude MANIFEST.in +exclude README* +exclude LICENSE* +prune .* +exclude .* +exclude src/conf.py +recursive-exclude src *.rst +recursive-exclude src *.less +recursive-include src *.css +recursive-include src *.sql +prune src/**/__pycache__ +prune src/*_tests* +prune out + +#@ add local below diff --git a/setup.json b/setup.json index 94883dc..ad72186 100644 --- a/setup.json +++ b/setup.json @@ -11,7 +11,7 @@ "modules": [ "act4e_solutions" ], - "version": "7.1.2110151556", + "version": "0.1", "author": "", "author_email": "", "url": "" -- cgit v1.2.1 From 06d7fe1b95abfb57b4e8f95fd590a745cae18f0e Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Fri, 15 Oct 2021 23:34:11 +0200 Subject: Bump to version 7.1.2110152134 --- setup.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.json b/setup.json index ad72186..f1ddb19 100644 --- a/setup.json +++ b/setup.json @@ -11,7 +11,7 @@ "modules": [ "act4e_solutions" ], - "version": "0.1", + "version": "7.1.2110152134", "author": "", "author_email": "", "url": "" -- cgit v1.2.1 From 738acb0c3ef00272f57cf960a5b79e1857464c78 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Sat, 16 Oct 2021 14:42:16 +0200 Subject: fix --- Dockerfile | 3 ++- Makefile | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8377abd..0d45fbc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM docker.io/andreacensi/act4e:spring2021 +ARG REGISTRY +FROM ${REGISTRY}/act4e/act4e-tests:alphubel WORKDIR /ACT4E diff --git a/Makefile b/Makefile index 037ff7a..cea6e06 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,14 @@ all: +REGISTRY ?= reg-z7-prod.zuper.ai + tag=mytag pull: - docker pull andreacensi/act4e:spring2021 + docker pull ${REGISTRY}/act4e/act4e-tests:alphubel build: pull - docker build -t $(tag) . + docker build -t $(tag) . check: build -- cgit v1.2.1 From 9b87f9da73cd8100756ea2e5fed93b8dd078290a Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Sat, 16 Oct 2021 14:42:23 +0200 Subject: Bump to version 7.1.2110161242 --- setup.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.json b/setup.json index f1ddb19..a6b49dc 100644 --- a/setup.json +++ b/setup.json @@ -11,7 +11,7 @@ "modules": [ "act4e_solutions" ], - "version": "7.1.2110152134", + "version": "7.1.2110161242", "author": "", "author_email": "", "url": "" -- cgit v1.2.1 From b9f1b77d7b00cbfe7d7df3896f4bc9d382f9659c Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Sat, 16 Oct 2021 15:09:57 +0200 Subject: [ci skip] --- setup.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.json b/setup.json index a6b49dc..68097ab 100644 --- a/setup.json +++ b/setup.json @@ -11,8 +11,8 @@ "modules": [ "act4e_solutions" ], - "version": "7.1.2110161242", + "version": "7.2", "author": "", "author_email": "", "url": "" -} \ No newline at end of file +} -- cgit v1.2.1 From 3b06beb88960bd6ca42ba21b92058b12e813bc3f Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Sat, 16 Oct 2021 15:10:18 +0200 Subject: Bump to version 7.1.2110161309 --- setup.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.json b/setup.json index 68097ab..dec488f 100644 --- a/setup.json +++ b/setup.json @@ -11,8 +11,8 @@ "modules": [ "act4e_solutions" ], - "version": "7.2", + "version": "7.1.2110161309", "author": "", "author_email": "", "url": "" -} +} \ No newline at end of file -- cgit v1.2.1 From 7f96ed6e4536a8aec46ed6639d00682f0cb812e8 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Sun, 17 Oct 2021 11:51:04 +0200 Subject: [ci skip] --- Dockerfile | 4 ++-- Makefile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0d45fbc..8d27c13 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -ARG REGISTRY -FROM ${REGISTRY}/act4e/act4e-tests:alphubel +ARG DOCKER_REGISTRY +FROM ${DOCKER_REGISTRY}/act4e/act4e-tests:alphubel WORKDIR /ACT4E diff --git a/Makefile b/Makefile index cea6e06..598e600 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ all: -REGISTRY ?= reg-z7-prod.zuper.ai +DOCKER_REGISTRY ?= reg-z7-prod.zuper.ai tag=mytag pull: - docker pull ${REGISTRY}/act4e/act4e-tests:alphubel + docker pull ${DOCKER_REGISTRY}/act4e/act4e-tests:alphubel build: pull docker build -t $(tag) . -- cgit v1.2.1 From d29698e68a6547f0709ba52abd34134aec218a0f Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Sun, 17 Oct 2021 11:51:22 +0200 Subject: Bump to version 7.1.2110170951 --- setup.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.json b/setup.json index dec488f..1969c40 100644 --- a/setup.json +++ b/setup.json @@ -11,7 +11,7 @@ "modules": [ "act4e_solutions" ], - "version": "7.1.2110161309", + "version": "7.1.2110170951", "author": "", "author_email": "", "url": "" -- cgit v1.2.1 From d12cc9f958fc0cef18bb9d2dd00e2aa7f97d9a2e Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Mon, 21 Feb 2022 11:20:26 +0100 Subject: fix --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 598e600..83fd1b8 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ pull: docker pull ${DOCKER_REGISTRY}/act4e/act4e-tests:alphubel build: pull - docker build -t $(tag) . + docker build --build-arg DOCKER_REGISTRY=${DOCKER_REGISTRY} -t $(tag) . check: build -- cgit v1.2.1 From caf6385a6b68209a0fe15a34e538d4bc654bcd9e Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Mon, 21 Feb 2022 11:59:37 +0100 Subject: Bump to version 7.1.2202211020 [ci skip] --- setup.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.json b/setup.json index 1969c40..f84b7d9 100644 --- a/setup.json +++ b/setup.json @@ -11,7 +11,7 @@ "modules": [ "act4e_solutions" ], - "version": "7.1.2110170951", + "version": "7.1.2202211020", "author": "", "author_email": "", "url": "" -- cgit v1.2.1 From 9c08526fb5e948401de286168924a32b42d449a8 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Mon, 21 Feb 2022 11:59:42 +0100 Subject: Bump to version 7.1.2202211059 [ci skip] --- setup.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.json b/setup.json index f84b7d9..202644e 100644 --- a/setup.json +++ b/setup.json @@ -11,7 +11,7 @@ "modules": [ "act4e_solutions" ], - "version": "7.1.2202211020", + "version": "7.1.2202211059", "author": "", "author_email": "", "url": "" -- cgit v1.2.1 From 5a5331537c3fa89ac1a553e101997e945ce97bc0 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Mon, 21 Feb 2022 12:22:37 +0100 Subject: skeletons --- src/act4e_solutions/intro.py | 6 ++ src/act4e_solutions/maps.py | 26 ++++++++ src/act4e_solutions/maps_representation.py | 17 ++++++ src/act4e_solutions/posets.py | 0 src/act4e_solutions/posets_bounds.py | 76 ++++++++++++++++++++++++ src/act4e_solutions/posets_construction.py | 18 ++++++ src/act4e_solutions/posets_interval.py | 33 ++++++++++ src/act4e_solutions/posets_map.py | 15 +++++ src/act4e_solutions/posets_monoidal.py | 12 ++++ src/act4e_solutions/posets_product.py | 10 ++++ src/act4e_solutions/posets_representation.py | 12 ++++ src/act4e_solutions/posets_sum.py | 18 ++++++ src/act4e_solutions/py.typed | 0 src/act4e_solutions/relations.py | 61 +++++++++++++++++++ src/act4e_solutions/relations_representation.py | 15 +++++ src/act4e_solutions/semigroups.py | 10 ++++ src/act4e_solutions/semigroups_representation.py | 30 ++++++++++ src/act4e_solutions/sets.py | 14 +++++ src/act4e_solutions/sets_power.py | 18 ++++++ src/act4e_solutions/sets_product.py | 18 ++++++ src/act4e_solutions/sets_properties.py | 30 ++++++++++ src/act4e_solutions/sets_representation.py | 13 ++++ src/act4e_solutions/sets_sum.py | 19 ++++++ src/act4e_solutions/sets_union_inter.py | 28 +++++++++ 24 files changed, 499 insertions(+) create mode 100644 src/act4e_solutions/intro.py create mode 100644 src/act4e_solutions/maps.py create mode 100644 src/act4e_solutions/maps_representation.py create mode 100644 src/act4e_solutions/posets.py create mode 100644 src/act4e_solutions/posets_bounds.py create mode 100644 src/act4e_solutions/posets_construction.py create mode 100644 src/act4e_solutions/posets_interval.py create mode 100644 src/act4e_solutions/posets_map.py create mode 100644 src/act4e_solutions/posets_monoidal.py create mode 100644 src/act4e_solutions/posets_product.py create mode 100644 src/act4e_solutions/posets_representation.py create mode 100644 src/act4e_solutions/posets_sum.py create mode 100644 src/act4e_solutions/py.typed create mode 100644 src/act4e_solutions/relations.py create mode 100644 src/act4e_solutions/relations_representation.py create mode 100644 src/act4e_solutions/semigroups.py create mode 100644 src/act4e_solutions/semigroups_representation.py create mode 100644 src/act4e_solutions/sets.py create mode 100644 src/act4e_solutions/sets_power.py create mode 100644 src/act4e_solutions/sets_product.py create mode 100644 src/act4e_solutions/sets_properties.py create mode 100644 src/act4e_solutions/sets_representation.py create mode 100644 src/act4e_solutions/sets_sum.py create mode 100644 src/act4e_solutions/sets_union_inter.py diff --git a/src/act4e_solutions/intro.py b/src/act4e_solutions/intro.py new file mode 100644 index 0000000..4d8207f --- /dev/null +++ b/src/act4e_solutions/intro.py @@ -0,0 +1,6 @@ +import act4e_interfaces as I + + +class MySimpleIntro(I.SimpleIntro): + def sum(self, a: int, b: int) -> int: + raise NotImplementedError() diff --git a/src/act4e_solutions/maps.py b/src/act4e_solutions/maps.py new file mode 100644 index 0000000..cf4e98f --- /dev/null +++ b/src/act4e_solutions/maps.py @@ -0,0 +1,26 @@ +from typing import overload, TypeVar + +import act4e_interfaces as I + +A = TypeVar("A") +B = TypeVar("B") +C = TypeVar("C") + + +class MyFiniteMapOperations(I.FiniteMapOperations): + @overload + def identity(self, s: I.FiniteSet[A]) -> I.FiniteMap[A, A]: + ... + + @overload + def identity(self, s: I.Setoid[A]) -> I.Mapping[A, A]: + ... + + def identity(self, s: I.Setoid[A]) -> I.Mapping[A, A]: + raise NotImplementedError() + + def compose(self, f: I.FiniteMap[A, B], g: I.FiniteMap[B, C]) -> I.FiniteMap[A, C]: + raise NotImplementedError() + + def as_relation(self, f: I.FiniteMap[A, B]) -> I.FiniteRelation[A, B]: + raise NotImplementedError() diff --git a/src/act4e_solutions/maps_representation.py b/src/act4e_solutions/maps_representation.py new file mode 100644 index 0000000..b77ef06 --- /dev/null +++ b/src/act4e_solutions/maps_representation.py @@ -0,0 +1,17 @@ +from typing import Any, TypeVar + +import act4e_interfaces as I + +__all__ = ["MyFiniteMapRepresentation"] + +A = TypeVar("A") +B = TypeVar("B") + + +class MyFiniteMapRepresentation(I.FiniteMapRepresentation): + + def load(self, h: I.IOHelper, s: I.FiniteMap_desc) -> I.FiniteMap[A, B]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteMap[Any, Any]) -> I.FiniteMap_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets.py b/src/act4e_solutions/posets.py new file mode 100644 index 0000000..e69de29 diff --git a/src/act4e_solutions/posets_bounds.py b/src/act4e_solutions/posets_bounds.py new file mode 100644 index 0000000..d582e67 --- /dev/null +++ b/src/act4e_solutions/posets_bounds.py @@ -0,0 +1,76 @@ +from typing import Any, List, Optional, overload, TypeVar + +import act4e_interfaces as I + +E = TypeVar("E") +X = TypeVar("X") + +__all__ = ["MyFinitePosetMeasurement"] + + +class MyFinitePosetMeasurement(I.FinitePosetMeasurement): + def height(self, fp: I.FinitePoset[Any]) -> int: + raise NotImplementedError() + + def width(self, fp: I.FinitePoset[Any]) -> int: + raise NotImplementedError() + + +class MyFinitePosetConstructionOpposite(I.FinitePosetConstructionOpposite): + @overload + def opposite(self, p: I.FinitePoset[X]) -> I.FinitePoset[X]: + ... + + @overload + def opposite(self, p: I.Poset[X]) -> I.Poset[X]: + ... + + def opposite(self, m: I.Poset[X]) -> I.Poset[X]: + raise NotImplementedError() + + +class MyFinitePosetSubsetProperties(I.FinitePosetSubsetProperties): + def is_chain(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + raise NotImplementedError() + + def is_antichain(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + raise NotImplementedError() + + +class MyFinitePosetSubsetProperties2(I.FinitePosetSubsetProperties2): + + def is_lower_set(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + raise NotImplementedError() + + def is_upper_set(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + raise NotImplementedError() + + +class MyFinitePosetClosures(I.FinitePosetClosures): + def upper_closure(self, fp: I.FinitePoset[X], s: List[X]) -> List[X]: + raise NotImplementedError() + + def lower_closure(self, fp: I.FinitePoset[X], s: List[X]) -> List[X]: + raise NotImplementedError() + + +class MyFinitePosetInfSup(I.FinitePosetInfSup): + def lower_bounds(self, fp: I.FinitePoset[E], s: List[E]) -> List[E]: + raise NotImplementedError() + + def upper_bounds(self, fp: I.FinitePoset[E], s: List[E]) -> List[E]: + raise NotImplementedError() + + def infimum(self, fp: I.FinitePoset[E], s: List[E]) -> Optional[E]: + raise NotImplementedError() + + def supremum(self, fp: I.FinitePoset[E], s: List[E]) -> Optional[E]: + raise NotImplementedError() + + +class MyFinitePosetMinMax(I.FinitePosetMinMax): + def minimal(self, fp: I.FinitePoset[E], S: List[E]) -> List[E]: + raise NotImplementedError() + + def maximal(self, fp: I.FinitePoset[E], S: List[E]) -> List[E]: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_construction.py b/src/act4e_solutions/posets_construction.py new file mode 100644 index 0000000..f7fb2ae --- /dev/null +++ b/src/act4e_solutions/posets_construction.py @@ -0,0 +1,18 @@ +from typing import Any, overload, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyPosetConstructionPower(I.PosetConstructionPower): + @overload + def powerposet(self, s: I.FiniteSet[X]) -> I.FinitePosetOfFiniteSubsets[X, Any]: + ... + + @overload + def powerposet(self, s: I.Setoid[X]) -> I.PosetOfFiniteSubsets[X, Any]: + ... + + def powerposet(self, s: I.Setoid[X]) -> I.PosetOfFiniteSubsets[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_interval.py b/src/act4e_solutions/posets_interval.py new file mode 100644 index 0000000..0553811 --- /dev/null +++ b/src/act4e_solutions/posets_interval.py @@ -0,0 +1,33 @@ +from typing import Any, overload, TypeVar + +import act4e_interfaces as I + +C = TypeVar("C") +E = TypeVar("E") +X = TypeVar("X") + + +class MyFinitePosetConstructionTwisted(I.FinitePosetConstructionTwisted): + @overload + def twisted(self, s: I.FinitePoset[X]) -> I.FinitePosetOfIntervals[X, Any]: + ... + + @overload + def twisted(self, s: I.Poset[X]) -> I.PosetOfIntervals[X, Any]: + ... + + def twisted(self, s: I.Poset[X]) -> I.PosetOfIntervals[X, Any]: + raise NotImplementedError() + + +class MyFinitePosetConstructionArrow(I.FinitePosetConstructionArrow): + @overload + def arrow(self, s: I.FinitePoset[X]) -> I.FinitePosetOfIntervals[X, Any]: + ... + + @overload + def arrow(self, s: I.Poset[X]) -> I.PosetOfIntervals[X, Any]: + ... + + def arrow(self, s: I.Poset[X]) -> I.PosetOfIntervals[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_map.py b/src/act4e_solutions/posets_map.py new file mode 100644 index 0000000..d2671bb --- /dev/null +++ b/src/act4e_solutions/posets_map.py @@ -0,0 +1,15 @@ +from typing import TypeVar + +import act4e_interfaces as I + +A = TypeVar("A") +B = TypeVar("B") +X = TypeVar("X") + + +class MyFiniteMonotoneMapProperties(I.FiniteMonotoneMapProperties): + def is_monotone(self, p1: I.FinitePoset[A], p2: I.FinitePoset[B], m: I.FiniteMap[A, B]) -> bool: + raise NotImplementedError() + + def is_antitone(self, p1: I.FinitePoset[A], p2: I.FinitePoset[B], m: I.FiniteMap[A, B]) -> bool: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_monoidal.py b/src/act4e_solutions/posets_monoidal.py new file mode 100644 index 0000000..1c18ce6 --- /dev/null +++ b/src/act4e_solutions/posets_monoidal.py @@ -0,0 +1,12 @@ +from typing import TypeVar + +import act4e_interfaces as I + +A = TypeVar("A") +B = TypeVar("B") +X = TypeVar("X") + + +class MyMonoidalPosetOperations(I.MonoidalPosetOperations): + def is_monoidal_poset(self, fp: I.FinitePoset[X], fm: I.FiniteMonoid[X]) -> bool: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_product.py b/src/act4e_solutions/posets_product.py new file mode 100644 index 0000000..035eabe --- /dev/null +++ b/src/act4e_solutions/posets_product.py @@ -0,0 +1,10 @@ +from typing import Any, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyFinitePosetConstructionProduct(I.FinitePosetConstructionProduct): + def product(self, ps: Sequence[I.FinitePoset[X]]) -> I.FinitePosetProduct[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_representation.py b/src/act4e_solutions/posets_representation.py new file mode 100644 index 0000000..9bdca1f --- /dev/null +++ b/src/act4e_solutions/posets_representation.py @@ -0,0 +1,12 @@ +from typing import Any + +import act4e_interfaces as I + + +class MyFinitePosetRepresentation(I.FinitePosetRepresentation): + + def load(self, h: I.IOHelper, s: I.FinitePoset_desc) -> I.FinitePoset[Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, p: I.FinitePoset[Any]) -> I.FinitePoset_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/posets_sum.py b/src/act4e_solutions/posets_sum.py new file mode 100644 index 0000000..a91b0a0 --- /dev/null +++ b/src/act4e_solutions/posets_sum.py @@ -0,0 +1,18 @@ +from typing import Any, overload, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyFinitePosetConstructionSum(I.FinitePosetConstructionSum): + @overload + def disjoint_union(self, ps: Sequence[I.FinitePoset[X]]) -> I.FinitePosetDisjointUnion[X, Any]: + ... + + @overload + def disjoint_union(self, ps: Sequence[I.Poset[X]]) -> I.PosetDisjointUnion[X, Any]: + ... + + def disjoint_union(self, ps: Sequence[I.Poset[X]]) -> I.PosetDisjointUnion[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/py.typed b/src/act4e_solutions/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/act4e_solutions/relations.py b/src/act4e_solutions/relations.py new file mode 100644 index 0000000..47a7c3e --- /dev/null +++ b/src/act4e_solutions/relations.py @@ -0,0 +1,61 @@ +from typing import Any, TypeVar + +import act4e_interfaces as I +from act4e_interfaces import FiniteRelation + +E1 = TypeVar("E1") +E2 = TypeVar("E2") +E3 = TypeVar("E3") +E = TypeVar("E") + +A = TypeVar("A") +B = TypeVar("B") + + +class MyFiniteRelationProperties(I.FiniteRelationProperties): + def is_surjective(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_defined_everywhere(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_injective(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_single_valued(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + +class MyFiniteRelationOperations(I.FiniteRelationOperations): + def transpose(self, fr: I.FiniteRelation[A, B]) -> I.FiniteRelation[B, A]: + raise NotImplementedError() + + +class MyFiniteEndorelationProperties(I.FiniteEndorelationProperties): + def is_reflexive(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_irreflexive(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_transitive(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_symmetric(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_antisymmetric(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + def is_asymmetric(self, fr: I.FiniteRelation[Any, Any]) -> bool: + raise NotImplementedError() + + +class MyFiniteEndorelationOperations(I.FiniteEndorelationOperations): + def transitive_closure(self, fr: I.FiniteRelation[E, E]) -> I.FiniteRelation[E, E]: + raise NotImplementedError() + + +class MyFiniteRelationCompose(I.FiniteRelationCompose): + def compose(self, fr1: FiniteRelation[E1, E2], fr2: FiniteRelation[E2, E3]) -> I.FiniteRelation[E1, E3]: + raise NotImplementedError() diff --git a/src/act4e_solutions/relations_representation.py b/src/act4e_solutions/relations_representation.py new file mode 100644 index 0000000..e150534 --- /dev/null +++ b/src/act4e_solutions/relations_representation.py @@ -0,0 +1,15 @@ +from typing import TypeVar + +import act4e_interfaces as I + +A = TypeVar("A") +B = TypeVar("B") + + +class MyFiniteRelationRepresentation(I.FiniteRelationRepresentation): + + def load(self, h: I.IOHelper, data: I.FiniteRelation_desc) -> I.FiniteRelation[A, B]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, f: I.FiniteRelation[A, B]) -> I.FiniteRelation_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/semigroups.py b/src/act4e_solutions/semigroups.py new file mode 100644 index 0000000..31ecd58 --- /dev/null +++ b/src/act4e_solutions/semigroups.py @@ -0,0 +1,10 @@ +from typing import List, TypeVar + +import act4e_interfaces as I + +C = TypeVar("C") + + +class MyFiniteSemigroupConstruct(I.FiniteSemigroupConstruct): + def free(self, fs: I.FiniteSet[C]) -> I.FreeSemigroup[C, List[C]]: + raise NotImplementedError() diff --git a/src/act4e_solutions/semigroups_representation.py b/src/act4e_solutions/semigroups_representation.py new file mode 100644 index 0000000..5d90823 --- /dev/null +++ b/src/act4e_solutions/semigroups_representation.py @@ -0,0 +1,30 @@ +from typing import Any, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyFiniteSemigroupRepresentation(I.FiniteSemigroupRepresentation): + + def load(self, h: I.IOHelper, s: I.FiniteSemigroup_desc) -> I.FiniteSemigroup[Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteSemigroup[Any]) -> I.FiniteSemigroup_desc: + raise NotImplementedError() + + +class MyFiniteMonoidRepresentation(I.FiniteMonoidRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteMonoid_desc) -> I.FiniteMonoid[X]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteMonoid[Any]) -> I.FiniteMonoid_desc: + raise NotImplementedError() + + +class MyFiniteGroupRepresentation(I.FiniteGroupRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteGroup_desc) -> I.FiniteGroup[X]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteGroup[Any]) -> I.FiniteGroup_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets.py b/src/act4e_solutions/sets.py new file mode 100644 index 0000000..7cb4252 --- /dev/null +++ b/src/act4e_solutions/sets.py @@ -0,0 +1,14 @@ +from typing import Callable, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyEnumerableSetsOperations(I.EnumerableSetsOperations): + def make_set_sequence(self, f: Callable[[int], X]) -> I.EnumerableSet[X]: + raise NotImplementedError() + + def union_esets(self, a: I.EnumerableSet[X], b: I.EnumerableSet[X]) -> I.EnumerableSet[X]: + """Creates the union of two EnumerableSet.""" + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_power.py b/src/act4e_solutions/sets_power.py new file mode 100644 index 0000000..1f3c103 --- /dev/null +++ b/src/act4e_solutions/sets_power.py @@ -0,0 +1,18 @@ +from typing import Any, overload, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyMakePowerSet(I.MakePowerSet): + @overload + def powerset(self, s: I.FiniteSet[X]) -> I.FiniteSetOfFiniteSubsets[X, Any]: + ... + + @overload + def powerset(self, s: I.Setoid[X]) -> I.SetOfFiniteSubsets[X, Any]: + ... + + def powerset(self, s: I.Setoid[X]) -> I.SetOfFiniteSubsets[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_product.py b/src/act4e_solutions/sets_product.py new file mode 100644 index 0000000..19661ca --- /dev/null +++ b/src/act4e_solutions/sets_product.py @@ -0,0 +1,18 @@ +from typing import Any, overload, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyMakeSetProduct(I.MakeSetProduct): + @overload + def product(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetProduct[X, Any]: + ... + + @overload + def product(self, components: Sequence[I.Setoid[X]]) -> I.SetProduct[X, Any]: + ... + + def product(self, components: Sequence[I.Setoid[X]]) -> I.SetProduct[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_properties.py b/src/act4e_solutions/sets_properties.py new file mode 100644 index 0000000..ef9f291 --- /dev/null +++ b/src/act4e_solutions/sets_properties.py @@ -0,0 +1,30 @@ +from typing import Any, overload, Sequence, TypeVar + +import act4e_interfaces as I + +__all__ = ["MyMakeSetUnion", "MyMakeSetIntersection", "MyFiniteSetProperties"] + +X = TypeVar("X") + + +class MyFiniteSetProperties(I.FiniteSetProperties): + def is_subset(self, a: I.FiniteSet[X], b: I.FiniteSet[X]) -> bool: + raise NotImplementedError() + + +class MyMakeSetUnion(I.MakeSetUnion): + @overload + def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]: + ... + + @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 MyMakeSetIntersection(I.MakeSetIntersection): + def intersection(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSet[X]: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_representation.py b/src/act4e_solutions/sets_representation.py new file mode 100644 index 0000000..d8c56d7 --- /dev/null +++ b/src/act4e_solutions/sets_representation.py @@ -0,0 +1,13 @@ +from typing import Any + +import act4e_interfaces as I + +__all__ = ["MyFiniteSetRepresentation"] + + +class MyFiniteSetRepresentation(I.FiniteSetRepresentation): + def load(self, h: I.IOHelper, data: I.FiniteSet_desc) -> I.FiniteSet[Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, f: I.FiniteSet[Any]) -> I.FiniteSet_desc: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_sum.py b/src/act4e_solutions/sets_sum.py new file mode 100644 index 0000000..54e0e95 --- /dev/null +++ b/src/act4e_solutions/sets_sum.py @@ -0,0 +1,19 @@ +from typing import Any, overload, Sequence, TypeVar + +import act4e_interfaces as I + + +X = TypeVar("X") + + +class MyMakeSetDisjointUnion(I.MakeSetDisjointUnion): + @overload + def disjoint_union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetDisjointUnion[X, Any]: + ... + + @overload + def disjoint_union(self, components: Sequence[I.Setoid[X]]) -> I.SetDisjointUnion[X, Any]: + ... + + def disjoint_union(self, components: Sequence[I.Setoid[X]]) -> I.SetDisjointUnion[X, Any]: + raise NotImplementedError() diff --git a/src/act4e_solutions/sets_union_inter.py b/src/act4e_solutions/sets_union_inter.py new file mode 100644 index 0000000..72f9e64 --- /dev/null +++ b/src/act4e_solutions/sets_union_inter.py @@ -0,0 +1,28 @@ +from typing import Any, overload, Sequence, TypeVar + +import act4e_interfaces as I + +X = TypeVar("X") + + +class MyMakeSetUnion(I.MakeSetUnion): + @overload + def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]: + ... + + @overload + def union(self, components: Sequence[I.EnumerableSet[X]]) -> I.EnumerableSetUnion[X, Any]: + ... + + def union(self, components: Sequence[I.EnumerableSet[X]]) -> I.EnumerableSetUnion[X, Any]: + raise NotImplementedError() + + +class MySetoidOperations(I.SetoidOperations): + @classmethod + def union_setoids(cls, a: I.Setoid[X], b: I.Setoid[X]) -> I.Setoid[X]: + raise NotImplementedError() + + @classmethod + def intersection_setoids(cls, a: I.Setoid[X], b: I.Setoid[X]) -> I.Setoid[X]: + raise NotImplementedError() -- cgit v1.2.1 From d62a8ad709eace9441e3d8e4e1249d3979dd9a44 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Mon, 21 Feb 2022 12:22:48 +0100 Subject: Bump to version 7.1.2202211122 [ci skip] --- setup.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.json b/setup.json index 202644e..5f0d486 100644 --- a/setup.json +++ b/setup.json @@ -11,7 +11,7 @@ "modules": [ "act4e_solutions" ], - "version": "7.1.2202211059", + "version": "7.1.2202211122", "author": "", "author_email": "", "url": "" -- cgit v1.2.1 From cc712ed5fdf07e24af3ac0a133f483c506af55a9 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Mon, 21 Feb 2022 12:24:14 +0100 Subject: skeletons --- src/act4e_solutions/intro.py | 2 +- src/act4e_solutions/maps.py | 2 +- src/act4e_solutions/maps_representation.py | 5 ++--- src/act4e_solutions/posets_bounds.py | 19 ++++++++----------- src/act4e_solutions/posets_construction.py | 2 +- src/act4e_solutions/posets_interval.py | 4 ++-- src/act4e_solutions/posets_map.py | 2 +- src/act4e_solutions/posets_monoidal.py | 2 +- src/act4e_solutions/posets_product.py | 2 +- src/act4e_solutions/posets_representation.py | 2 +- src/act4e_solutions/posets_sum.py | 2 +- src/act4e_solutions/relations.py | 10 +++++----- src/act4e_solutions/relations_representation.py | 2 +- src/act4e_solutions/semigroups.py | 2 +- src/act4e_solutions/semigroups_representation.py | 6 +++--- src/act4e_solutions/sets.py | 2 +- src/act4e_solutions/sets_power.py | 2 +- src/act4e_solutions/sets_product.py | 2 +- src/act4e_solutions/sets_properties.py | 10 ++++------ src/act4e_solutions/sets_representation.py | 6 ++---- src/act4e_solutions/sets_sum.py | 2 +- src/act4e_solutions/sets_union_inter.py | 4 ++-- 22 files changed, 42 insertions(+), 50 deletions(-) diff --git a/src/act4e_solutions/intro.py b/src/act4e_solutions/intro.py index 4d8207f..2a4856d 100644 --- a/src/act4e_solutions/intro.py +++ b/src/act4e_solutions/intro.py @@ -1,6 +1,6 @@ import act4e_interfaces as I -class MySimpleIntro(I.SimpleIntro): +class SolSimpleIntro(I.SimpleIntro): def sum(self, a: int, b: int) -> int: raise NotImplementedError() diff --git a/src/act4e_solutions/maps.py b/src/act4e_solutions/maps.py index cf4e98f..4984eef 100644 --- a/src/act4e_solutions/maps.py +++ b/src/act4e_solutions/maps.py @@ -7,7 +7,7 @@ B = TypeVar("B") C = TypeVar("C") -class MyFiniteMapOperations(I.FiniteMapOperations): +class SolFiniteMapOperations(I.FiniteMapOperations): @overload def identity(self, s: I.FiniteSet[A]) -> I.FiniteMap[A, A]: ... diff --git a/src/act4e_solutions/maps_representation.py b/src/act4e_solutions/maps_representation.py index b77ef06..45c816e 100644 --- a/src/act4e_solutions/maps_representation.py +++ b/src/act4e_solutions/maps_representation.py @@ -1,14 +1,13 @@ from typing import Any, TypeVar import act4e_interfaces as I - -__all__ = ["MyFiniteMapRepresentation"] + A = TypeVar("A") B = TypeVar("B") -class MyFiniteMapRepresentation(I.FiniteMapRepresentation): +class SolFiniteMapRepresentation(I.FiniteMapRepresentation): def load(self, h: I.IOHelper, s: I.FiniteMap_desc) -> I.FiniteMap[A, B]: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_bounds.py b/src/act4e_solutions/posets_bounds.py index d582e67..73adc98 100644 --- a/src/act4e_solutions/posets_bounds.py +++ b/src/act4e_solutions/posets_bounds.py @@ -3,12 +3,9 @@ from typing import Any, List, Optional, overload, TypeVar import act4e_interfaces as I E = TypeVar("E") -X = TypeVar("X") +X = TypeVar("X") -__all__ = ["MyFinitePosetMeasurement"] - - -class MyFinitePosetMeasurement(I.FinitePosetMeasurement): +class SolFinitePosetMeasurement(I.FinitePosetMeasurement): def height(self, fp: I.FinitePoset[Any]) -> int: raise NotImplementedError() @@ -16,7 +13,7 @@ class MyFinitePosetMeasurement(I.FinitePosetMeasurement): raise NotImplementedError() -class MyFinitePosetConstructionOpposite(I.FinitePosetConstructionOpposite): +class SolFinitePosetConstructionOpposite(I.FinitePosetConstructionOpposite): @overload def opposite(self, p: I.FinitePoset[X]) -> I.FinitePoset[X]: ... @@ -29,7 +26,7 @@ class MyFinitePosetConstructionOpposite(I.FinitePosetConstructionOpposite): raise NotImplementedError() -class MyFinitePosetSubsetProperties(I.FinitePosetSubsetProperties): +class SolFinitePosetSubsetProperties(I.FinitePosetSubsetProperties): def is_chain(self, fp: I.FinitePoset[X], s: List[X]) -> bool: raise NotImplementedError() @@ -37,7 +34,7 @@ class MyFinitePosetSubsetProperties(I.FinitePosetSubsetProperties): raise NotImplementedError() -class MyFinitePosetSubsetProperties2(I.FinitePosetSubsetProperties2): +class SolFinitePosetSubsetProperties2(I.FinitePosetSubsetProperties2): def is_lower_set(self, fp: I.FinitePoset[X], s: List[X]) -> bool: raise NotImplementedError() @@ -46,7 +43,7 @@ class MyFinitePosetSubsetProperties2(I.FinitePosetSubsetProperties2): raise NotImplementedError() -class MyFinitePosetClosures(I.FinitePosetClosures): +class SolFinitePosetClosures(I.FinitePosetClosures): def upper_closure(self, fp: I.FinitePoset[X], s: List[X]) -> List[X]: raise NotImplementedError() @@ -54,7 +51,7 @@ class MyFinitePosetClosures(I.FinitePosetClosures): raise NotImplementedError() -class MyFinitePosetInfSup(I.FinitePosetInfSup): +class SolFinitePosetInfSup(I.FinitePosetInfSup): def lower_bounds(self, fp: I.FinitePoset[E], s: List[E]) -> List[E]: raise NotImplementedError() @@ -68,7 +65,7 @@ class MyFinitePosetInfSup(I.FinitePosetInfSup): raise NotImplementedError() -class MyFinitePosetMinMax(I.FinitePosetMinMax): +class SolFinitePosetMinMax(I.FinitePosetMinMax): def minimal(self, fp: I.FinitePoset[E], S: List[E]) -> List[E]: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_construction.py b/src/act4e_solutions/posets_construction.py index f7fb2ae..065f931 100644 --- a/src/act4e_solutions/posets_construction.py +++ b/src/act4e_solutions/posets_construction.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyPosetConstructionPower(I.PosetConstructionPower): +class SolPosetConstructionPower(I.PosetConstructionPower): @overload def powerposet(self, s: I.FiniteSet[X]) -> I.FinitePosetOfFiniteSubsets[X, Any]: ... diff --git a/src/act4e_solutions/posets_interval.py b/src/act4e_solutions/posets_interval.py index 0553811..bd164eb 100644 --- a/src/act4e_solutions/posets_interval.py +++ b/src/act4e_solutions/posets_interval.py @@ -7,7 +7,7 @@ E = TypeVar("E") X = TypeVar("X") -class MyFinitePosetConstructionTwisted(I.FinitePosetConstructionTwisted): +class SolFinitePosetConstructionTwisted(I.FinitePosetConstructionTwisted): @overload def twisted(self, s: I.FinitePoset[X]) -> I.FinitePosetOfIntervals[X, Any]: ... @@ -20,7 +20,7 @@ class MyFinitePosetConstructionTwisted(I.FinitePosetConstructionTwisted): raise NotImplementedError() -class MyFinitePosetConstructionArrow(I.FinitePosetConstructionArrow): +class SolFinitePosetConstructionArrow(I.FinitePosetConstructionArrow): @overload def arrow(self, s: I.FinitePoset[X]) -> I.FinitePosetOfIntervals[X, Any]: ... diff --git a/src/act4e_solutions/posets_map.py b/src/act4e_solutions/posets_map.py index d2671bb..a91d4d8 100644 --- a/src/act4e_solutions/posets_map.py +++ b/src/act4e_solutions/posets_map.py @@ -7,7 +7,7 @@ B = TypeVar("B") X = TypeVar("X") -class MyFiniteMonotoneMapProperties(I.FiniteMonotoneMapProperties): +class SolFiniteMonotoneMapProperties(I.FiniteMonotoneMapProperties): def is_monotone(self, p1: I.FinitePoset[A], p2: I.FinitePoset[B], m: I.FiniteMap[A, B]) -> bool: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_monoidal.py b/src/act4e_solutions/posets_monoidal.py index 1c18ce6..96afedc 100644 --- a/src/act4e_solutions/posets_monoidal.py +++ b/src/act4e_solutions/posets_monoidal.py @@ -7,6 +7,6 @@ B = TypeVar("B") X = TypeVar("X") -class MyMonoidalPosetOperations(I.MonoidalPosetOperations): +class SolMonoidalPosetOperations(I.MonoidalPosetOperations): def is_monoidal_poset(self, fp: I.FinitePoset[X], fm: I.FiniteMonoid[X]) -> bool: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_product.py b/src/act4e_solutions/posets_product.py index 035eabe..bf67efd 100644 --- a/src/act4e_solutions/posets_product.py +++ b/src/act4e_solutions/posets_product.py @@ -5,6 +5,6 @@ import act4e_interfaces as I X = TypeVar("X") -class MyFinitePosetConstructionProduct(I.FinitePosetConstructionProduct): +class SolFinitePosetConstructionProduct(I.FinitePosetConstructionProduct): def product(self, ps: Sequence[I.FinitePoset[X]]) -> I.FinitePosetProduct[X, Any]: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_representation.py b/src/act4e_solutions/posets_representation.py index 9bdca1f..d7b2991 100644 --- a/src/act4e_solutions/posets_representation.py +++ b/src/act4e_solutions/posets_representation.py @@ -3,7 +3,7 @@ from typing import Any import act4e_interfaces as I -class MyFinitePosetRepresentation(I.FinitePosetRepresentation): +class SolFinitePosetRepresentation(I.FinitePosetRepresentation): def load(self, h: I.IOHelper, s: I.FinitePoset_desc) -> I.FinitePoset[Any]: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_sum.py b/src/act4e_solutions/posets_sum.py index a91b0a0..3081c7f 100644 --- a/src/act4e_solutions/posets_sum.py +++ b/src/act4e_solutions/posets_sum.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyFinitePosetConstructionSum(I.FinitePosetConstructionSum): +class SolFinitePosetConstructionSum(I.FinitePosetConstructionSum): @overload def disjoint_union(self, ps: Sequence[I.FinitePoset[X]]) -> I.FinitePosetDisjointUnion[X, Any]: ... diff --git a/src/act4e_solutions/relations.py b/src/act4e_solutions/relations.py index 47a7c3e..048b500 100644 --- a/src/act4e_solutions/relations.py +++ b/src/act4e_solutions/relations.py @@ -12,7 +12,7 @@ A = TypeVar("A") B = TypeVar("B") -class MyFiniteRelationProperties(I.FiniteRelationProperties): +class SolFiniteRelationProperties(I.FiniteRelationProperties): def is_surjective(self, fr: I.FiniteRelation[Any, Any]) -> bool: raise NotImplementedError() @@ -26,12 +26,12 @@ class MyFiniteRelationProperties(I.FiniteRelationProperties): raise NotImplementedError() -class MyFiniteRelationOperations(I.FiniteRelationOperations): +class SolFiniteRelationOperations(I.FiniteRelationOperations): def transpose(self, fr: I.FiniteRelation[A, B]) -> I.FiniteRelation[B, A]: raise NotImplementedError() -class MyFiniteEndorelationProperties(I.FiniteEndorelationProperties): +class SolFiniteEndorelationProperties(I.FiniteEndorelationProperties): def is_reflexive(self, fr: I.FiniteRelation[Any, Any]) -> bool: raise NotImplementedError() @@ -51,11 +51,11 @@ class MyFiniteEndorelationProperties(I.FiniteEndorelationProperties): raise NotImplementedError() -class MyFiniteEndorelationOperations(I.FiniteEndorelationOperations): +class SolFiniteEndorelationOperations(I.FiniteEndorelationOperations): def transitive_closure(self, fr: I.FiniteRelation[E, E]) -> I.FiniteRelation[E, E]: raise NotImplementedError() -class MyFiniteRelationCompose(I.FiniteRelationCompose): +class SolFiniteRelationCompose(I.FiniteRelationCompose): def compose(self, fr1: FiniteRelation[E1, E2], fr2: FiniteRelation[E2, E3]) -> I.FiniteRelation[E1, E3]: raise NotImplementedError() diff --git a/src/act4e_solutions/relations_representation.py b/src/act4e_solutions/relations_representation.py index e150534..8dbde1c 100644 --- a/src/act4e_solutions/relations_representation.py +++ b/src/act4e_solutions/relations_representation.py @@ -6,7 +6,7 @@ A = TypeVar("A") B = TypeVar("B") -class MyFiniteRelationRepresentation(I.FiniteRelationRepresentation): +class SolFiniteRelationRepresentation(I.FiniteRelationRepresentation): def load(self, h: I.IOHelper, data: I.FiniteRelation_desc) -> I.FiniteRelation[A, B]: raise NotImplementedError() diff --git a/src/act4e_solutions/semigroups.py b/src/act4e_solutions/semigroups.py index 31ecd58..1b02766 100644 --- a/src/act4e_solutions/semigroups.py +++ b/src/act4e_solutions/semigroups.py @@ -5,6 +5,6 @@ import act4e_interfaces as I C = TypeVar("C") -class MyFiniteSemigroupConstruct(I.FiniteSemigroupConstruct): +class SolFiniteSemigroupConstruct(I.FiniteSemigroupConstruct): def free(self, fs: I.FiniteSet[C]) -> I.FreeSemigroup[C, List[C]]: raise NotImplementedError() diff --git a/src/act4e_solutions/semigroups_representation.py b/src/act4e_solutions/semigroups_representation.py index 5d90823..23e2ba1 100644 --- a/src/act4e_solutions/semigroups_representation.py +++ b/src/act4e_solutions/semigroups_representation.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyFiniteSemigroupRepresentation(I.FiniteSemigroupRepresentation): +class SolFiniteSemigroupRepresentation(I.FiniteSemigroupRepresentation): def load(self, h: I.IOHelper, s: I.FiniteSemigroup_desc) -> I.FiniteSemigroup[Any]: raise NotImplementedError() @@ -14,7 +14,7 @@ class MyFiniteSemigroupRepresentation(I.FiniteSemigroupRepresentation): raise NotImplementedError() -class MyFiniteMonoidRepresentation(I.FiniteMonoidRepresentation): +class SolFiniteMonoidRepresentation(I.FiniteMonoidRepresentation): def load(self, h: I.IOHelper, s: I.FiniteMonoid_desc) -> I.FiniteMonoid[X]: raise NotImplementedError() @@ -22,7 +22,7 @@ class MyFiniteMonoidRepresentation(I.FiniteMonoidRepresentation): raise NotImplementedError() -class MyFiniteGroupRepresentation(I.FiniteGroupRepresentation): +class SolFiniteGroupRepresentation(I.FiniteGroupRepresentation): def load(self, h: I.IOHelper, s: I.FiniteGroup_desc) -> I.FiniteGroup[X]: raise NotImplementedError() diff --git a/src/act4e_solutions/sets.py b/src/act4e_solutions/sets.py index 7cb4252..1dc635f 100644 --- a/src/act4e_solutions/sets.py +++ b/src/act4e_solutions/sets.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyEnumerableSetsOperations(I.EnumerableSetsOperations): +class SolEnumerableSetsOperations(I.EnumerableSetsOperations): def make_set_sequence(self, f: Callable[[int], X]) -> I.EnumerableSet[X]: raise NotImplementedError() diff --git a/src/act4e_solutions/sets_power.py b/src/act4e_solutions/sets_power.py index 1f3c103..2e9c970 100644 --- a/src/act4e_solutions/sets_power.py +++ b/src/act4e_solutions/sets_power.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyMakePowerSet(I.MakePowerSet): +class SolMakePowerSet(I.MakePowerSet): @overload def powerset(self, s: I.FiniteSet[X]) -> I.FiniteSetOfFiniteSubsets[X, Any]: ... diff --git a/src/act4e_solutions/sets_product.py b/src/act4e_solutions/sets_product.py index 19661ca..d3e5558 100644 --- a/src/act4e_solutions/sets_product.py +++ b/src/act4e_solutions/sets_product.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyMakeSetProduct(I.MakeSetProduct): +class SolMakeSetProduct(I.MakeSetProduct): @overload def product(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetProduct[X, Any]: ... diff --git a/src/act4e_solutions/sets_properties.py b/src/act4e_solutions/sets_properties.py index ef9f291..1a2ab88 100644 --- a/src/act4e_solutions/sets_properties.py +++ b/src/act4e_solutions/sets_properties.py @@ -1,18 +1,16 @@ from typing import Any, overload, Sequence, TypeVar import act4e_interfaces as I - -__all__ = ["MyMakeSetUnion", "MyMakeSetIntersection", "MyFiniteSetProperties"] - + X = TypeVar("X") -class MyFiniteSetProperties(I.FiniteSetProperties): +class SolFiniteSetProperties(I.FiniteSetProperties): def is_subset(self, a: I.FiniteSet[X], b: I.FiniteSet[X]) -> bool: raise NotImplementedError() -class MyMakeSetUnion(I.MakeSetUnion): +class SolMakeSetUnion(I.MakeSetUnion): @overload def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]: ... @@ -25,6 +23,6 @@ class MyMakeSetUnion(I.MakeSetUnion): raise NotImplementedError() -class MyMakeSetIntersection(I.MakeSetIntersection): +class SolMakeSetIntersection(I.MakeSetIntersection): def intersection(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSet[X]: raise NotImplementedError() diff --git a/src/act4e_solutions/sets_representation.py b/src/act4e_solutions/sets_representation.py index d8c56d7..10d89c9 100644 --- a/src/act4e_solutions/sets_representation.py +++ b/src/act4e_solutions/sets_representation.py @@ -1,11 +1,9 @@ from typing import Any import act4e_interfaces as I + -__all__ = ["MyFiniteSetRepresentation"] - - -class MyFiniteSetRepresentation(I.FiniteSetRepresentation): +class SolFiniteSetRepresentation(I.FiniteSetRepresentation): def load(self, h: I.IOHelper, data: I.FiniteSet_desc) -> I.FiniteSet[Any]: raise NotImplementedError() diff --git a/src/act4e_solutions/sets_sum.py b/src/act4e_solutions/sets_sum.py index 54e0e95..ee82985 100644 --- a/src/act4e_solutions/sets_sum.py +++ b/src/act4e_solutions/sets_sum.py @@ -6,7 +6,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyMakeSetDisjointUnion(I.MakeSetDisjointUnion): +class SolMakeSetDisjointUnion(I.MakeSetDisjointUnion): @overload def disjoint_union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetDisjointUnion[X, Any]: ... diff --git a/src/act4e_solutions/sets_union_inter.py b/src/act4e_solutions/sets_union_inter.py index 72f9e64..3a4c419 100644 --- a/src/act4e_solutions/sets_union_inter.py +++ b/src/act4e_solutions/sets_union_inter.py @@ -5,7 +5,7 @@ import act4e_interfaces as I X = TypeVar("X") -class MyMakeSetUnion(I.MakeSetUnion): +class SolMakeSetUnion(I.MakeSetUnion): @overload def union(self, components: Sequence[I.FiniteSet[X]]) -> I.FiniteSetUnion[X, Any]: ... @@ -18,7 +18,7 @@ class MyMakeSetUnion(I.MakeSetUnion): raise NotImplementedError() -class MySetoidOperations(I.SetoidOperations): +class SolSetoidOperations(I.SetoidOperations): @classmethod def union_setoids(cls, a: I.Setoid[X], b: I.Setoid[X]) -> I.Setoid[X]: raise NotImplementedError() -- cgit v1.2.1 From 40d60ddd68670de4224aa805a6fcb54846342cf9 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Mon, 21 Feb 2022 12:24:23 +0100 Subject: Bump to version 7.1.2202211124 [ci skip] --- setup.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.json b/setup.json index 5f0d486..f6a4dd8 100644 --- a/setup.json +++ b/setup.json @@ -11,7 +11,7 @@ "modules": [ "act4e_solutions" ], - "version": "7.1.2202211122", + "version": "7.1.2202211124", "author": "", "author_email": "", "url": "" -- cgit v1.2.1 From fe30f8bc7f8ce822ae412d5b939b4dc414b68b99 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Mon, 21 Feb 2022 17:28:48 +0100 Subject: fix --- .pre-commit-config.yaml | 61 +++++++++++++++++-------------------------------- setup.json | 2 +- 2 files changed, 22 insertions(+), 41 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d373e7a..a5c6e90 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,42 +1,23 @@ ---- -repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 - hooks: - - id: check-added-large-files - - id: check-case-conflict - - id: check-executables-have-shebangs - - id: check-merge-conflict - - id: check-symlinks -# - id: trailing-whitespace -# - id: end-of-file-fixer -# - id: check-yaml -# - id: check-json -# - id: check-docstring-first -# - id: flake8 -# args: [--max-line-length=100] -- repo: https://github.com/psf/black - rev: 20.8b1 - hooks: - - id: black - language_version: python3.8 - args: [-l, '110'] -#- repo: https://github.com/adrienverge/yamllint.git -# rev: v1.26.1 # or higher tag -# hooks: -# - id: yamllint -# args: [--format, parsable] -- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt - rev: 0.1.0 # or specific tag - hooks: - - id: yamlfmt - args: [--mapping, '2', --sequence, '2', --offset, '0', --width, '150', --preserve-quotes] - -# args: [--mapping, '2', --sequence, '0', --offset, '0', --width, '150'] - - -#exclude: .bumpversion.cfg - +exclude: .pre-commit-config.yaml files: (^src/.*py)|(.*yaml) +repos: +- hooks: + - {id: check-added-large-files} + - {id: check-case-conflict} + - {id: check-executables-have-shebangs} + - {id: check-merge-conflict} + - {id: check-symlinks} + repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 +- hooks: + - args: [-l, '110', -t, py38] + id: black + repo: https://github.com/psf/black + rev: 21.12b0 +- hooks: + - args: [--mapping, '2', --sequence, '2', --offset, '0', --width, '150', --preserve-quotes] + id: yamlfmt + repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 0.1.0 -# sigil 3d9109598d23dfbb339c65e4dae064bd +# sigil 1b050e28e72b639bc7781ce39208defb diff --git a/setup.json b/setup.json index f6a4dd8..ad72186 100644 --- a/setup.json +++ b/setup.json @@ -11,7 +11,7 @@ "modules": [ "act4e_solutions" ], - "version": "7.1.2202211124", + "version": "0.1", "author": "", "author_email": "", "url": "" -- cgit v1.2.1 From e05f71320cf72cbad4d288514727b57979c7be22 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Mon, 21 Feb 2022 18:01:08 +0100 Subject: fix --- Dockerfile | 2 +- MANIFEST.in | 4 ---- Makefile | 6 ++++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8d27c13..78c1975 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG DOCKER_REGISTRY +ARG DOCKER_REGISTRY=docker.io FROM ${DOCKER_REGISTRY}/act4e/act4e-tests:alphubel WORKDIR /ACT4E diff --git a/MANIFEST.in b/MANIFEST.in index dc1dc93..4e280e6 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -12,10 +12,6 @@ exclude LICENSE* prune .* exclude .* exclude src/conf.py -recursive-exclude src *.rst -recursive-exclude src *.less -recursive-include src *.css -recursive-include src *.sql prune src/**/__pycache__ prune src/*_tests* prune out diff --git a/Makefile b/Makefile index 83fd1b8..dfc1e28 100644 --- a/Makefile +++ b/Makefile @@ -12,9 +12,11 @@ build: pull check: build - docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) act4e-tests --module act4e_solutions + docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) \ + act4e-test --collections act4e_checks --module act4e_solutions check-%: build - docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) act4e-tests --module act4e_solutions --group $* + docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) \ + act4e-test --collections act4e_checks --module act4e_solutions --group $* -- cgit v1.2.1 From 6e943c21c2ab9dfbf754ffeed76066f08b8bfc09 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Mon, 21 Feb 2022 22:32:36 +0100 Subject: ok --- .gitignore | 1 + Dockerfile | 7 +++++-- setup.json | 18 ------------------ setup.py | 17 +++++++++-------- 4 files changed, 15 insertions(+), 28 deletions(-) delete mode 100644 setup.json diff --git a/.gitignore b/.gitignore index 9bea433..ad71b0c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .DS_Store +.python-version diff --git a/Dockerfile b/Dockerfile index 78c1975..d029f7f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,11 @@ -ARG DOCKER_REGISTRY=docker.io -FROM ${DOCKER_REGISTRY}/act4e/act4e-tests:alphubel +# ARG DOCKER_REGISTRY=docker.io +# FROM ${DOCKER_REGISTRY}/act4e/act4e-tests:alphubel +FROM python:3.10 +RUN python3 -m pip install -U pip -v WORKDIR /ACT4E +RUN uname -a COPY requirements.txt . RUN python3 -m pip install -r requirements.txt diff --git a/setup.json b/setup.json deleted file mode 100644 index f6a4dd8..0000000 --- a/setup.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "install_requires": [], - "tests_require": [], - "srcdir": "src", - "package_name": "ACT4E-MySolutions", - "entry_points": { - "console_scripts": [] - }, - "zip_safe": true, - "include_package_data": true, - "modules": [ - "act4e_solutions" - ], - "version": "7.1.2202211124", - "author": "", - "author_email": "", - "url": "" -} \ No newline at end of file diff --git a/setup.py b/setup.py index e64c8cc..e20c8f1 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,11 @@ from setuptools import find_packages, setup -setup(name='ACT4E-MySolutions', - version="0.1", - package_dir={'': 'src'}, - packages=find_packages('src'), - entry_points={ - }, - extras_require={}, - ) +setup( +name='ACT4E-MySolutions', +version="0.1", +package_dir={'': 'src'}, +packages=find_packages('src'), +entry_points={}, +extras_require={}, +install_requires=['ACT4E-exercises'], +) -- cgit v1.2.1 From 337213bbd4431554e3ea9cb332b6a71da8080a14 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Mon, 21 Feb 2022 22:38:09 +0100 Subject: fix --- Makefile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Makefile b/Makefile index dfc1e28..5177571 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,8 @@ all: -DOCKER_REGISTRY ?= reg-z7-prod.zuper.ai - tag=mytag -pull: - docker pull ${DOCKER_REGISTRY}/act4e/act4e-tests:alphubel - -build: pull +build: docker build --build-arg DOCKER_REGISTRY=${DOCKER_REGISTRY} -t $(tag) . -- cgit v1.2.1 From 3f79a6e32d329531e99b05da5f83b4227f75fd2d Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Tue, 22 Feb 2022 13:38:05 +0100 Subject: fix --- .devcontainer/Dockerfile | 21 +++++++++++++++++ .devcontainer/devcontainer.json | 52 +++++++++++++++++++++++++++++++++++++++++ Makefile | 6 ++++- requirements.txt | 1 + 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..86dee1b --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,21 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/python-3/.devcontainer/base.Dockerfile + +# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster +ARG VARIANT="3.10-bullseye" +FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} + +# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 +ARG NODE_VERSION="none" +RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi + +# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image. +COPY requirements.txt /tmp/pip-tmp/ +RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ + && rm -rf /tmp/pip-tmp + +# [Optional] Uncomment this section to install additional OS packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + +# [Optional] Uncomment this line to install global node packages. +# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..6970d3c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,52 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/python-3 +{ + "name": "Python 3", + "build": { + "dockerfile": "Dockerfile", + "context": "..", + "args": { + // Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6 + // Append -bullseye or -buster to pin to an OS version. + // Use -bullseye variants on local on arm64/Apple Silicon. + "VARIANT": "3.10", + // Options + "NODE_VERSION": "none" + } + }, + + // Set *default* container specific settings.json values on container create. + "settings": { + "python.defaultInterpreterPath": "/usr/local/bin/python", + "python.linting.enabled": false, + "python.linting.pylintEnabled": false, + "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", + "python.formatting.blackPath": "/usr/local/py-utils/bin/black", + "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", + "python.linting.banditPath": "/usr/local/py-utils/bin/bandit", + "python.linting.flake8Path": "/usr/local/py-utils/bin/flake8", + "python.linting.mypyPath": "/usr/local/py-utils/bin/mypy", + "python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle", + "python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle", + "python.linting.pylintPath": "/usr/local/py-utils/bin/pylint" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-python.python", + // "ms-python.vscode-pylance" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "pip3 install --user -r requirements.txt", + + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode", + "features": { + "git": "os-provided", + "git-lfs": "latest" + } +} diff --git a/Makefile b/Makefile index 5177571..0aca7d6 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,6 @@ tag=mytag build: docker build --build-arg DOCKER_REGISTRY=${DOCKER_REGISTRY} -t $(tag) . - check: build docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) \ act4e-test --collections act4e_checks --module act4e_solutions @@ -15,3 +14,8 @@ check-%: build docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) \ act4e-test --collections act4e_checks --module act4e_solutions --group $* +local-check: + act4e-test --collections act4e_checks --module act4e_solutions + +local-check-%: + act4e-test --collections act4e_checks --module act4e_solutions --group $* \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index e69de29..87bfd82 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1 @@ +ACT4E-exercises \ No newline at end of file -- cgit v1.2.1 From e2dd6011ad2abcec220220f14efdb451c986aea3 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Tue, 22 Feb 2022 13:54:04 +0100 Subject: fix --- .devcontainer/devcontainer.json | 3 ++- Makefile | 8 ++++---- README.md | 30 ++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 README.md diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6970d3c..626e731 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -9,7 +9,7 @@ // Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6 // Append -bullseye or -buster to pin to an OS version. // Use -bullseye variants on local on arm64/Apple Silicon. - "VARIANT": "3.10", + "VARIANT": "3.10-bullseye", // Options "NODE_VERSION": "none" } @@ -34,6 +34,7 @@ // Add the IDs of extensions you want installed when the container is created. "extensions": [ "ms-python.python", + "tht13.html-preview-vscode", // "ms-python.vscode-pylance" ], diff --git a/Makefile b/Makefile index 0aca7d6..3090a59 100644 --- a/Makefile +++ b/Makefile @@ -5,17 +5,17 @@ tag=mytag build: docker build --build-arg DOCKER_REGISTRY=${DOCKER_REGISTRY} -t $(tag) . -check: build +docker-check: build docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) \ act4e-test --collections act4e_checks --module act4e_solutions -check-%: build +docker-check-%: build docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) \ act4e-test --collections act4e_checks --module act4e_solutions --group $* -local-check: +check: act4e-test --collections act4e_checks --module act4e_solutions -local-check-%: +check-%: act4e-test --collections act4e_checks --module act4e_solutions --group $* \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..bf98d63 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ + + +## Setup + +Install VS Code. + +Select File -> Open and select *the entire folder*. + +VS Code will give you a message similar to: + +> Folder contains a Dev Container configuration file. Reopen folder to develop in a container. + +Select "Reopen in container". + +Now you should have the folder open while VS Code is in "container development mode". + +Create a new terminal using Terminal -> New Terminal. + +Run the following: + + make check-TestSimpleIntro + +This will have created a file `out-results/result-TestSimpleIntro.html`. + +From the file tree to the left, right-click the file and select "open preview". You will see the results of the testing. + +Now browse the Python files in `src/`. Verify that autocompletion works.. + + + -- cgit v1.2.1 From d33763817e7501bd2ff81f7d5da1900c9d15c8d2 Mon Sep 17 00:00:00 2001 From: Gioele Zardini <32289677+gzardini@users.noreply.github.com> Date: Tue, 22 Feb 2022 14:04:08 +0100 Subject: Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index bf98d63..5bb6b79 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ Install VS Code. Select File -> Open and select *the entire folder*. +VS Code will propose to install "Dev Container". Click "install". + VS Code will give you a message similar to: > Folder contains a Dev Container configuration file. Reopen folder to develop in a container. -- cgit v1.2.1 From c9c95b13effa1840b921a0606936510d7eafa611 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Tue, 22 Feb 2022 14:09:51 +0100 Subject: updates --- .devcontainer/Dockerfile | 3 +++ .devcontainer/devcontainer.json | 4 ++-- .pre-commit-config.yaml | 18 ++---------------- .pylintrc | 6 ++++++ requirements.txt | 3 ++- src/act4e_solutions/maps_representation.py | 2 -- src/act4e_solutions/posets_bounds.py | 4 ++-- src/act4e_solutions/posets_representation.py | 1 - src/act4e_solutions/relations_representation.py | 1 - src/act4e_solutions/semigroups_representation.py | 1 - src/act4e_solutions/sets_properties.py | 2 +- src/act4e_solutions/sets_representation.py | 2 +- 12 files changed, 19 insertions(+), 28 deletions(-) create mode 100644 .pylintrc diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 86dee1b..f50f4d2 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -8,6 +8,9 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} ARG NODE_VERSION="none" RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi +RUN pip3 --disable-pip-version-check --no-cache-dir install -U pip pre-commit + + # [Optional] If your pip requirements rarely change, uncomment this section to add them to the image. COPY requirements.txt /tmp/pip-tmp/ RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 626e731..c3fc20e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -18,8 +18,8 @@ // Set *default* container specific settings.json values on container create. "settings": { "python.defaultInterpreterPath": "/usr/local/bin/python", - "python.linting.enabled": false, - "python.linting.pylintEnabled": false, + "python.linting.enabled": true, + "python.linting.pylintEnabled": true, "python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8", "python.formatting.blackPath": "/usr/local/py-utils/bin/black", "python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf", diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d373e7a..f4adb4c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v4.1.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -16,27 +16,13 @@ repos: # - id: flake8 # args: [--max-line-length=100] - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 22.1.0 hooks: - id: black - language_version: python3.8 args: [-l, '110'] -#- repo: https://github.com/adrienverge/yamllint.git -# rev: v1.26.1 # or higher tag -# hooks: -# - id: yamllint -# args: [--format, parsable] - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt rev: 0.1.0 # or specific tag hooks: - id: yamlfmt args: [--mapping, '2', --sequence, '2', --offset, '0', --width, '150', --preserve-quotes] - -# args: [--mapping, '2', --sequence, '0', --offset, '0', --width, '150'] - - -#exclude: .bumpversion.cfg - files: (^src/.*py)|(.*yaml) - -# sigil 3d9109598d23dfbb339c65e4dae064bd diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..5671bbf --- /dev/null +++ b/.pylintrc @@ -0,0 +1,6 @@ +[MASTER] +disable= + C0114, # missing-module-docstring + C0115, # missing-class-docstring + C0116, # missing-function-docstring + C0103, # pylint complains about the TypeVar names https://github.com/PyCQA/pylint/issues/3324 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 87bfd82..28fee9e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -ACT4E-exercises \ No newline at end of file +ACT4E-exercises +pre-commit \ No newline at end of file diff --git a/src/act4e_solutions/maps_representation.py b/src/act4e_solutions/maps_representation.py index 45c816e..f532658 100644 --- a/src/act4e_solutions/maps_representation.py +++ b/src/act4e_solutions/maps_representation.py @@ -1,14 +1,12 @@ from typing import Any, TypeVar import act4e_interfaces as I - A = TypeVar("A") B = TypeVar("B") class SolFiniteMapRepresentation(I.FiniteMapRepresentation): - def load(self, h: I.IOHelper, s: I.FiniteMap_desc) -> I.FiniteMap[A, B]: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_bounds.py b/src/act4e_solutions/posets_bounds.py index 73adc98..eca887f 100644 --- a/src/act4e_solutions/posets_bounds.py +++ b/src/act4e_solutions/posets_bounds.py @@ -3,7 +3,8 @@ from typing import Any, List, Optional, overload, TypeVar import act4e_interfaces as I E = TypeVar("E") -X = TypeVar("X") +X = TypeVar("X") + class SolFinitePosetMeasurement(I.FinitePosetMeasurement): def height(self, fp: I.FinitePoset[Any]) -> int: @@ -35,7 +36,6 @@ class SolFinitePosetSubsetProperties(I.FinitePosetSubsetProperties): class SolFinitePosetSubsetProperties2(I.FinitePosetSubsetProperties2): - def is_lower_set(self, fp: I.FinitePoset[X], s: List[X]) -> bool: raise NotImplementedError() diff --git a/src/act4e_solutions/posets_representation.py b/src/act4e_solutions/posets_representation.py index d7b2991..c43da82 100644 --- a/src/act4e_solutions/posets_representation.py +++ b/src/act4e_solutions/posets_representation.py @@ -4,7 +4,6 @@ import act4e_interfaces as I class SolFinitePosetRepresentation(I.FinitePosetRepresentation): - def load(self, h: I.IOHelper, s: I.FinitePoset_desc) -> I.FinitePoset[Any]: raise NotImplementedError() diff --git a/src/act4e_solutions/relations_representation.py b/src/act4e_solutions/relations_representation.py index 8dbde1c..69ccdf0 100644 --- a/src/act4e_solutions/relations_representation.py +++ b/src/act4e_solutions/relations_representation.py @@ -7,7 +7,6 @@ B = TypeVar("B") class SolFiniteRelationRepresentation(I.FiniteRelationRepresentation): - def load(self, h: I.IOHelper, data: I.FiniteRelation_desc) -> I.FiniteRelation[A, B]: raise NotImplementedError() diff --git a/src/act4e_solutions/semigroups_representation.py b/src/act4e_solutions/semigroups_representation.py index 23e2ba1..4d75708 100644 --- a/src/act4e_solutions/semigroups_representation.py +++ b/src/act4e_solutions/semigroups_representation.py @@ -6,7 +6,6 @@ X = TypeVar("X") class SolFiniteSemigroupRepresentation(I.FiniteSemigroupRepresentation): - def load(self, h: I.IOHelper, s: I.FiniteSemigroup_desc) -> I.FiniteSemigroup[Any]: raise NotImplementedError() diff --git a/src/act4e_solutions/sets_properties.py b/src/act4e_solutions/sets_properties.py index 1a2ab88..cca6de9 100644 --- a/src/act4e_solutions/sets_properties.py +++ b/src/act4e_solutions/sets_properties.py @@ -1,7 +1,7 @@ from typing import Any, overload, Sequence, TypeVar import act4e_interfaces as I - + X = TypeVar("X") diff --git a/src/act4e_solutions/sets_representation.py b/src/act4e_solutions/sets_representation.py index 10d89c9..7f3e818 100644 --- a/src/act4e_solutions/sets_representation.py +++ b/src/act4e_solutions/sets_representation.py @@ -1,7 +1,7 @@ from typing import Any import act4e_interfaces as I - + class SolFiniteSetRepresentation(I.FiniteSetRepresentation): def load(self, h: I.IOHelper, data: I.FiniteSet_desc) -> I.FiniteSet[Any]: -- cgit v1.2.1 From ded6a1bfc44269add5aa376760f8a209c8cd0c39 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Tue, 22 Feb 2022 14:14:37 +0100 Subject: some excludes --- .pylintrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index 5671bbf..d13ca13 100644 --- a/.pylintrc +++ b/.pylintrc @@ -3,4 +3,5 @@ disable= C0114, # missing-module-docstring C0115, # missing-class-docstring C0116, # missing-function-docstring - C0103, # pylint complains about the TypeVar names https://github.com/PyCQA/pylint/issues/3324 \ No newline at end of file + C0103, # pylint complains about the TypeVar names https://github.com/PyCQA/pylint/issues/3324 + R0903, # too few public methods \ No newline at end of file -- cgit v1.2.1 From 8071f2f72dfb157d37f3239d7b1d85f960e77885 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Tue, 22 Feb 2022 14:19:09 +0100 Subject: settings --- .gitignore | 4 +++- .vscode/settings.json | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index ad71b0c..fcfda9f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ - +__pycache__ +*.pyc +*.egg-info .DS_Store .python-version diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a77d3ce --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.exclude": { + "**/__pycache__": true, + "**/*.egg-info": true + } +} \ No newline at end of file -- cgit v1.2.1 From 3bb42870c19a5c80925219e2a410eb99d5eabab1 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Tue, 22 Feb 2022 20:01:52 +0100 Subject: more comments --- src/act4e_solutions/maps.py | 8 +++++--- src/act4e_solutions/posets_bounds.py | 8 ++++---- src/act4e_solutions/posets_construction.py | 6 +++--- src/act4e_solutions/posets_interval.py | 12 ++++++------ src/act4e_solutions/posets_sum.py | 6 +++--- src/act4e_solutions/sets_power.py | 6 +++--- src/act4e_solutions/sets_product.py | 6 +++--- src/act4e_solutions/sets_sum.py | 6 +++--- src/act4e_solutions/sets_union_inter.py | 6 +++--- 9 files changed, 33 insertions(+), 31 deletions(-) diff --git a/src/act4e_solutions/maps.py b/src/act4e_solutions/maps.py index 4984eef..acba84e 100644 --- a/src/act4e_solutions/maps.py +++ b/src/act4e_solutions/maps.py @@ -10,14 +10,16 @@ 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() + raise NotImplementedError() # implement here + + # 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 73adc98..eef9c96 100644 --- a/src/act4e_solutions/posets_bounds.py +++ b/src/act4e_solutions/posets_bounds.py @@ -3,7 +3,7 @@ from typing import Any, List, Optional, overload, TypeVar import act4e_interfaces as I E = TypeVar("E") -X = TypeVar("X") +X = TypeVar("X") class SolFinitePosetMeasurement(I.FinitePosetMeasurement): def height(self, fp: I.FinitePoset[Any]) -> int: @@ -16,14 +16,14 @@ 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() + raise NotImplementedError() # implement here class SolFinitePosetSubsetProperties(I.FinitePosetSubsetProperties): diff --git a/src/act4e_solutions/posets_construction.py b/src/act4e_solutions/posets_construction.py index 065f931..ebcdec2 100644 --- a/src/act4e_solutions/posets_construction.py +++ b/src/act4e_solutions/posets_construction.py @@ -8,11 +8,11 @@ X = TypeVar("X") class SolPosetConstructionPower(I.PosetConstructionPower): @overload 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() + raise NotImplementedError() # implement here diff --git a/src/act4e_solutions/posets_interval.py b/src/act4e_solutions/posets_interval.py index bd164eb..368de53 100644 --- a/src/act4e_solutions/posets_interval.py +++ b/src/act4e_solutions/posets_interval.py @@ -10,24 +10,24 @@ 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() + raise NotImplementedError() # implement here 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() + raise NotImplementedError() # implement here diff --git a/src/act4e_solutions/posets_sum.py b/src/act4e_solutions/posets_sum.py index 3081c7f..6d657e0 100644 --- a/src/act4e_solutions/posets_sum.py +++ b/src/act4e_solutions/posets_sum.py @@ -8,11 +8,11 @@ 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() + raise NotImplementedError() # implement here diff --git a/src/act4e_solutions/sets_power.py b/src/act4e_solutions/sets_power.py index 2e9c970..1969d86 100644 --- a/src/act4e_solutions/sets_power.py +++ b/src/act4e_solutions/sets_power.py @@ -8,11 +8,11 @@ X = TypeVar("X") class SolMakePowerSet(I.MakePowerSet): @overload 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() + raise NotImplementedError() # implement here diff --git a/src/act4e_solutions/sets_product.py b/src/act4e_solutions/sets_product.py index d3e5558..f81f3fe 100644 --- a/src/act4e_solutions/sets_product.py +++ b/src/act4e_solutions/sets_product.py @@ -8,11 +8,11 @@ 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 def product(self, components: Sequence[I.Setoid[X]]) -> I.SetProduct[X, Any]: - raise NotImplementedError() + raise NotImplementedError() # implement here diff --git a/src/act4e_solutions/sets_sum.py b/src/act4e_solutions/sets_sum.py index ee82985..193a6a7 100644 --- a/src/act4e_solutions/sets_sum.py +++ b/src/act4e_solutions/sets_sum.py @@ -9,11 +9,11 @@ X = TypeVar("X") class SolMakeSetDisjointUnion(I.MakeSetDisjointUnion): @overload 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() + raise NotImplementedError() # implement here diff --git a/src/act4e_solutions/sets_union_inter.py b/src/act4e_solutions/sets_union_inter.py index 3a4c419..edf9bd0 100644 --- a/src/act4e_solutions/sets_union_inter.py +++ b/src/act4e_solutions/sets_union_inter.py @@ -8,14 +8,14 @@ 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 def union(self, components: Sequence[I.EnumerableSet[X]]) -> I.EnumerableSetUnion[X, Any]: - raise NotImplementedError() + raise NotImplementedError() # implement here class SolSetoidOperations(I.SetoidOperations): -- cgit v1.2.1 From b4484700a2fbf4a569ab9e2789d6ea3d24956731 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Wed, 23 Feb 2022 11:54:02 +0100 Subject: more comments --- src/act4e_solutions/maps.py | 3 --- src/act4e_solutions/relations.py | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/act4e_solutions/maps.py b/src/act4e_solutions/maps.py index acba84e..8f161f4 100644 --- a/src/act4e_solutions/maps.py +++ b/src/act4e_solutions/maps.py @@ -23,6 +23,3 @@ class SolFiniteMapOperations(I.FiniteMapOperations): def compose(self, f: I.FiniteMap[A, B], g: I.FiniteMap[B, C]) -> I.FiniteMap[A, C]: raise NotImplementedError() - - def as_relation(self, f: I.FiniteMap[A, B]) -> I.FiniteRelation[A, B]: - raise NotImplementedError() diff --git a/src/act4e_solutions/relations.py b/src/act4e_solutions/relations.py index 048b500..26f90a7 100644 --- a/src/act4e_solutions/relations.py +++ b/src/act4e_solutions/relations.py @@ -30,6 +30,9 @@ class SolFiniteRelationOperations(I.FiniteRelationOperations): def transpose(self, fr: I.FiniteRelation[A, B]) -> I.FiniteRelation[B, A]: raise NotImplementedError() + def as_relation(self, f: I.FiniteMap[A, B]) -> I.FiniteRelation[A, B]: + raise NotImplementedError() + class SolFiniteEndorelationProperties(I.FiniteEndorelationProperties): def is_reflexive(self, fr: I.FiniteRelation[Any, Any]) -> bool: -- cgit v1.2.1 From 5df248c0d5b67e1df4279f039384bb7e10423d4c Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Sat, 26 Feb 2022 12:40:14 +0100 Subject: more exercises --- src/act4e_solutions/maps.py | 13 ++----------- src/act4e_solutions/posets_bounds.py | 8 -------- src/act4e_solutions/posets_construction.py | 14 +++----------- src/act4e_solutions/posets_interval.py | 18 +----------------- src/act4e_solutions/posets_sum.py | 9 +-------- src/act4e_solutions/sets_power.py | 11 ++--------- src/act4e_solutions/sets_product.py | 15 ++++----------- src/act4e_solutions/sets_properties.py | 14 +++----------- src/act4e_solutions/sets_sum.py | 15 +++------------ 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 -- cgit v1.2.1 From 1987cc7f22a139fbd2ead1223ab878cddccd3f96 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Sun, 27 Feb 2022 13:07:33 +0100 Subject: fix --- .devcontainer/Dockerfile | 15 ++++++++++++--- .devcontainer/act4e-check | 16 ++++++++++++++++ .devcontainer/requirements.txt | 2 ++ Dockerfile | 2 +- Makefile | 12 ++++++------ requirements.txt | 2 -- 6 files changed, 37 insertions(+), 12 deletions(-) create mode 100644 .devcontainer/act4e-check create mode 100644 .devcontainer/requirements.txt delete mode 100644 requirements.txt diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index f50f4d2..120994e 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -10,9 +10,8 @@ RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/ RUN pip3 --disable-pip-version-check --no-cache-dir install -U pip pre-commit - # [Optional] If your pip requirements rarely change, uncomment this section to add them to the image. -COPY requirements.txt /tmp/pip-tmp/ +COPY .devcontainer/requirements.txt /tmp/pip-tmp/ RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ && rm -rf /tmp/pip-tmp @@ -21,4 +20,14 @@ RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requ # && apt-get -y install --no-install-recommends # [Optional] Uncomment this line to install global node packages. -# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 \ No newline at end of file +# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 + +COPY .devcontainer/act4e-check /usr/local/bin +RUN chmod +x /usr/local/bin/act4e-check + + +COPY src src +COPY setup.py . + +RUN python3 -m pip install -e . + diff --git a/.devcontainer/act4e-check b/.devcontainer/act4e-check new file mode 100644 index 0000000..d4fd9e7 --- /dev/null +++ b/.devcontainer/act4e-check @@ -0,0 +1,16 @@ +#!/bin/bash +set -eux +if [ $# -eq 0 ] + then + act4e-test --collections act4e_checks --module act4e_solutions +else +if [ $# -eq 1 ] + then + act4e-test --collections act4e_checks --module act4e_solutions --group $1 +else + echo "Need to pass either 0 or 1 argument" + exit 3 +fi +fi + + diff --git a/.devcontainer/requirements.txt b/.devcontainer/requirements.txt new file mode 100644 index 0000000..28fee9e --- /dev/null +++ b/.devcontainer/requirements.txt @@ -0,0 +1,2 @@ +ACT4E-exercises +pre-commit \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index d029f7f..e131248 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ RUN python3 -m pip install -U pip -v WORKDIR /ACT4E RUN uname -a -COPY requirements.txt . +COPY .devcontainer/requirements.txt . RUN python3 -m pip install -r requirements.txt COPY src src diff --git a/Makefile b/Makefile index 3090a59..9c80517 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ all: -tag=mytag +tag=act4e-image build: - docker build --build-arg DOCKER_REGISTRY=${DOCKER_REGISTRY} -t $(tag) . + docker build -f .devcontainer/Dockerfile --build-arg DOCKER_REGISTRY=${DOCKER_REGISTRY} -t $(tag) . docker-check: build docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) \ @@ -14,8 +14,8 @@ docker-check-%: build docker run -it --rm -v $(PWD)/out-results:/ACT4E/out-results $(tag) \ act4e-test --collections act4e_checks --module act4e_solutions --group $* -check: - act4e-test --collections act4e_checks --module act4e_solutions +# check: +# act4e-test --collections act4e_checks --module act4e_solutions -check-%: - act4e-test --collections act4e_checks --module act4e_solutions --group $* \ No newline at end of file +# check-%: +# act4e-test --collections act4e_checks --module act4e_solutions --group $* \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 28fee9e..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -ACT4E-exercises -pre-commit \ No newline at end of file -- cgit v1.2.1 From 8ea0a108552c7688682fd03e18ed9595350c5272 Mon Sep 17 00:00:00 2001 From: Gioele Zardini <32289677+gzardini@users.noreply.github.com> Date: Tue, 1 Mar 2022 08:47:02 +0100 Subject: Update README.md added docker installation --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5bb6b79..c3c8796 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,14 @@ ## Setup -Install VS Code. +### Install Docker +> (Mac, Linux) Follow the [installation instructions](https://docs.docker.com/get-docker/) +> (Windows): +>> Follow the manual installation steps for Windows Subsystem for Linux [here](https://docs.microsoft.com/en-us/windows/wsl/install). On step 1, follow the recommendation of updating to WSL 2. On step 6, you can download Ubuntu 18.04 LTS. You do not necessarily need to install Windows Terminal. +>> Now go [here](https://docs.docker.com/desktop/windows/install/) and follow the "Install Docker Desktop on Windows" instructions. You can then start Docker Desktop and follow the quick start quide. + + +### Install VS Code. Select File -> Open and select *the entire folder*. -- cgit v1.2.1 From e0907806400801df87bf8ffb7a8858def82f3d32 Mon Sep 17 00:00:00 2001 From: Gioele Zardini <32289677+gzardini@users.noreply.github.com> Date: Tue, 1 Mar 2022 08:49:13 +0100 Subject: Update README.md --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c3c8796..6c531e1 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,14 @@ ## Setup ### Install Docker -> (Mac, Linux) Follow the [installation instructions](https://docs.docker.com/get-docker/) -> (Windows): ->> Follow the manual installation steps for Windows Subsystem for Linux [here](https://docs.microsoft.com/en-us/windows/wsl/install). On step 1, follow the recommendation of updating to WSL 2. On step 6, you can download Ubuntu 18.04 LTS. You do not necessarily need to install Windows Terminal. ->> Now go [here](https://docs.docker.com/desktop/windows/install/) and follow the "Install Docker Desktop on Windows" instructions. You can then start Docker Desktop and follow the quick start quide. +
    +
  • (Mac, Linux) Follow the [installation instructions](https://docs.docker.com/get-docker/)
  • +
  • (Windows): +
  • Follow the manual installation steps for Windows Subsystem for Linux [here](https://docs.microsoft.com/en-us/windows/wsl/install). On step 1, follow the recommendation of updating to WSL 2. On step 6, you can download Ubuntu 18.04 LTS. You do not necessarily need to install Windows Terminal.
  • +
  • Now go [here](https://docs.docker.com/desktop/windows/install/) and follow the "Install Docker Desktop on Windows" instructions. You can then start Docker Desktop and follow the quick start quide.
  • +
+ + ### Install VS Code. -- cgit v1.2.1 From 3b3932e24e86a169bafdf9d12f50d339c2542c3e Mon Sep 17 00:00:00 2001 From: Gioele Zardini <32289677+gzardini@users.noreply.github.com> Date: Tue, 1 Mar 2022 08:49:44 +0100 Subject: Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6c531e1..2da0866 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@
  • (Mac, Linux) Follow the [installation instructions](https://docs.docker.com/get-docker/)
  • (Windows): +
    • Follow the manual installation steps for Windows Subsystem for Linux [here](https://docs.microsoft.com/en-us/windows/wsl/install). On step 1, follow the recommendation of updating to WSL 2. On step 6, you can download Ubuntu 18.04 LTS. You do not necessarily need to install Windows Terminal.
    • Now go [here](https://docs.docker.com/desktop/windows/install/) and follow the "Install Docker Desktop on Windows" instructions. You can then start Docker Desktop and follow the quick start quide.
    -- cgit v1.2.1 From 81d139453a441ad73905fd27fbad34484ca0c39e Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Wed, 2 Mar 2022 15:09:53 +0100 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2da0866..210ca92 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Create a new terminal using Terminal -> New Terminal. Run the following: - make check-TestSimpleIntro + act4e-check TestSimpleIntro This will have created a file `out-results/result-TestSimpleIntro.html`. -- cgit v1.2.1 From a3127ad923f712d23b8d66798c704c1084d8b7f1 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Wed, 2 Mar 2022 15:34:44 +0100 Subject: Update Dockerfile --- .devcontainer/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 120994e..601075b 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -26,8 +26,8 @@ COPY .devcontainer/act4e-check /usr/local/bin RUN chmod +x /usr/local/bin/act4e-check -COPY src src -COPY setup.py . +# COPY src src +# COPY setup.py . -RUN python3 -m pip install -e . +# RUN python3 -m pip install -e . -- cgit v1.2.1 From 5b4aacf96438e1bf7aa52fe76afbd07339387b14 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Tue, 15 Mar 2022 21:44:36 +0100 Subject: added template --- .../semigroups_morphisms_representation.py | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/act4e_solutions/semigroups_morphisms_representation.py diff --git a/src/act4e_solutions/semigroups_morphisms_representation.py b/src/act4e_solutions/semigroups_morphisms_representation.py new file mode 100644 index 0000000..43df89f --- /dev/null +++ b/src/act4e_solutions/semigroups_morphisms_representation.py @@ -0,0 +1,27 @@ +from typing import Any, TypeVar + +import act4e_interfaces as I + + +class SolFiniteSemigroupMorphismRepresentation(I.FiniteSemigroupMorphismRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteSemigroupMorphism_desc) -> I.FiniteSemigroupMorphism[Any, Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteSemigroupMorphism[Any, Any]) -> I.FiniteSemigroupMorphism_desc: + raise NotImplementedError() + + +class SolFiniteMonoidMorphismRepresentation(I.FiniteMonoidMorphismRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteMonoidMorphism_desc) -> I.FiniteMonoidMorphism[Any, Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteMonoidMorphism[Any, Any]) -> I.FiniteMonoidMorphism_desc: + raise NotImplementedError() + + +class SolFiniteGroupMorphismRepresentation(I.FiniteGroupMorphismRepresentation): + def load(self, h: I.IOHelper, s: I.FiniteGroupMorphism_desc) -> I.FiniteGroupMorphism[Any, Any]: + raise NotImplementedError() + + def save(self, h: I.IOHelper, m: I.FiniteGroupMorphism[Any, Any]) -> I.FiniteGroupMorphism_desc: + raise NotImplementedError() -- cgit v1.2.1 From 76d974e8dc2618313d1e2967eea5bb37e319b4c6 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Sun, 8 May 2022 17:25:56 +0200 Subject: minor --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index fcfda9f..9a5bb0b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ __pycache__ *.egg-info .DS_Store .python-version +.vscode/*log +.out-results/*html \ No newline at end of file -- cgit v1.2.1 From 201dbe2a5b615438fd81ad8ddb874d9fb0e47ba7 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Wed, 11 May 2022 19:40:26 +0200 Subject: minor --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 210ca92..c24aaf4 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ - - ## Setup ### Install Docker +
    • (Mac, Linux) Follow the [installation instructions](https://docs.docker.com/get-docker/)
    • (Windows): @@ -13,7 +12,6 @@
    - ### Install VS Code. Select File -> Open and select *the entire folder*. -- cgit v1.2.1 From d68e689e4e211dbafee305f2127f2f4f01d5a8d6 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Fri, 17 Feb 2023 21:28:01 +0100 Subject: misc --- MANIFEST.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MANIFEST.in b/MANIFEST.in index 4e280e6..be06279 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -12,8 +12,15 @@ exclude LICENSE* prune .* exclude .* exclude src/conf.py +recursive-exclude src *.rst +recursive-exclude src *.less +recursive-include src *.css +recursive-include src *.sql +recursive-include src py.typed prune src/**/__pycache__ prune src/*_tests* prune out +prune assets #@ add local below + -- cgit v1.2.1 From c12b2cf32061386a0a47517f9a7d31fdba73b5b8 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Fri, 17 Feb 2023 21:32:52 +0100 Subject: misc --- pyproject.toml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6300d7c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,23 @@ +[project] +name = "ACT4E-MySolutions" +version = "0.1" +authors = [{name = "", email = ""}] +dependencies = [ + "ACT4E-exercises", + ] + +[tool] +[tool.poetry] +name = "ACT4E-MySolutions" +version = "0.1" +description = "" +authors = [" <>"] +packages = [ + {from = "src", include = "act4e_solutions"}, + ] + +[tool.setuptools] +packages = [ + "act4e_solutions", + ] +package-dir = {"" = "src"} -- cgit v1.2.1 From 6c8351d32b1fbbac60370a8a10eaac9a9e36965c Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Wed, 18 Oct 2023 12:59:37 +0200 Subject: misc --- pyproject.toml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 6300d7c..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,23 +0,0 @@ -[project] -name = "ACT4E-MySolutions" -version = "0.1" -authors = [{name = "", email = ""}] -dependencies = [ - "ACT4E-exercises", - ] - -[tool] -[tool.poetry] -name = "ACT4E-MySolutions" -version = "0.1" -description = "" -authors = [" <>"] -packages = [ - {from = "src", include = "act4e_solutions"}, - ] - -[tool.setuptools] -packages = [ - "act4e_solutions", - ] -package-dir = {"" = "src"} -- cgit v1.2.1 From ddd8f64ab375a5f92058972215badf02508014c4 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Wed, 18 Oct 2023 13:52:26 +0200 Subject: misc --- src/act4e_solutions/semigroups_morphisms.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/act4e_solutions/semigroups_morphisms.py diff --git a/src/act4e_solutions/semigroups_morphisms.py b/src/act4e_solutions/semigroups_morphisms.py new file mode 100644 index 0000000..7c48610 --- /dev/null +++ b/src/act4e_solutions/semigroups_morphisms.py @@ -0,0 +1,16 @@ +from typing import Any, TypeVar + +import act4e_interfaces as I +A = TypeVar("A") +B = TypeVar("B") + + +class SolFiniteSemigroupMorphismsChecks(I.FiniteSemigroupMorphismsChecks): + def is_semigroup_morphism(self, a: I.FiniteSemigroup[A], b: I.FiniteSemigroup[B], f: I.FiniteMap[A, B]) -> bool: + raise NotImplementedError + + def is_monoid_morphism(self, a: I.FiniteMonoid[A], b: I.FiniteMonoid[B], f: I.FiniteMap[A, B]) -> bool: + raise NotImplementedError + + def is_group_morphism(self, a: I.FiniteGroup[A], b: I.FiniteGroup[B], f: I.FiniteMap[A, B]) -> bool: + raise NotImplementedError -- cgit v1.2.1 From b24b147b3456b3afdb51fb03253da1de3478d63e Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Thu, 26 Oct 2023 13:37:42 +0200 Subject: misc --- .devcontainer/devcontainer.json | 4 ++-- .devcontainer/requirements.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c3fc20e..70c3683 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -47,7 +47,7 @@ // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. "remoteUser": "vscode", "features": { - "git": "os-provided", - "git-lfs": "latest" + "git": "os-provided" + //"git-lfs": "latest" } } diff --git a/.devcontainer/requirements.txt b/.devcontainer/requirements.txt index 28fee9e..e36b067 100644 --- a/.devcontainer/requirements.txt +++ b/.devcontainer/requirements.txt @@ -1,2 +1,2 @@ -ACT4E-exercises -pre-commit \ No newline at end of file +ACT4E-exercises>=7.3.2310261331 +pre-commit -- cgit v1.2.1 From 636bb42728d3997039524657bc5ead5c27ab6a2e Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Thu, 26 Oct 2023 16:48:44 +0200 Subject: misc --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 70c3683..0754889 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -34,7 +34,7 @@ // Add the IDs of extensions you want installed when the container is created. "extensions": [ "ms-python.python", - "tht13.html-preview-vscode", + "tht13.html-preview-vscode" // "ms-python.vscode-pylance" ], -- cgit v1.2.1 From f522450580f1c6ca937cb3c455babdd597170faf Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Wed, 1 Nov 2023 10:18:52 +0100 Subject: misc --- src/act4e_solutions/posets_bounds.py | 6 ++-- src/act4e_solutions/semicategory_representation.py | 41 ++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 src/act4e_solutions/semicategory_representation.py diff --git a/src/act4e_solutions/posets_bounds.py b/src/act4e_solutions/posets_bounds.py index e1f9d26..0d50baf 100644 --- a/src/act4e_solutions/posets_bounds.py +++ b/src/act4e_solutions/posets_bounds.py @@ -1,4 +1,4 @@ -from typing import Any, List, Optional, overload, TypeVar +from typing import Any, List, Optional, overload, TypeVar, Collection import act4e_interfaces as I @@ -19,10 +19,10 @@ class SolFinitePosetConstructionOpposite(I.FinitePosetConstructionOpposite): class SolFinitePosetSubsetProperties(I.FinitePosetSubsetProperties): - def is_chain(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + def is_chain(self, fp: I.FinitePoset[X], s: Collection[X]) -> bool: raise NotImplementedError() - def is_antichain(self, fp: I.FinitePoset[X], s: List[X]) -> bool: + def is_antichain(self, fp: I.FinitePoset[X], s: Collection[X]) -> bool: raise NotImplementedError() diff --git a/src/act4e_solutions/semicategory_representation.py b/src/act4e_solutions/semicategory_representation.py new file mode 100644 index 0000000..860a451 --- /dev/null +++ b/src/act4e_solutions/semicategory_representation.py @@ -0,0 +1,41 @@ +from typing import Callable, Generic, Optional, TypeVar + +import act4e_interfaces as I +from act4e_interfaces import EnumerableSet + +OD = TypeVar("OD") +MD = TypeVar("MD") + + +class SolSemiCategoryRepresentation(I.SemiCategoryRepresentation): + def load( + self, + h: I.IOHelper, + data: I.FiniteSemiCategory_desc, + ObData: I.Setoid[OD], + MorData: I.Setoid[MD], + compose: Callable[[OD, OD, OD, MD, MD], MD], + ) -> I.SemiCategory[I.RichObject[OD], I.RichMorphism[MD]]: + raise NotImplementedError() + + +class SolSemiCategory(Generic[OD, MD], I.SemiCategory[I.RichObject[OD], I.RichMorphism[MD]]): + """ Skeleton for a class implementing SemiCategory.""" + + def __init__( + self, + add, more, parameters, here + ): + raise NotImplementedError + + def objects(self, uptolevel: Optional[int] = None) -> EnumerableSet[OD]: + raise NotImplementedError + + def hom(self, ob1: OD, ob2: OD, uptolevel: Optional[int] = None) -> EnumerableSet[MD]: + raise NotImplementedError + + def compose(self, ob1: OD, ob2: OD, ob3: OD, m1: MD, m2: MD) -> MD: + raise NotImplementedError + + def identity(self, ob: OD) -> MD: + raise NotImplementedError -- cgit v1.2.1 From c073cf4d57a81a86a9f34356a11519cfddd65eb1 Mon Sep 17 00:00:00 2001 From: Andrea Censi Date: Wed, 1 Nov 2023 10:24:43 +0100 Subject: misc --- src/act4e_solutions/currency_ex.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/act4e_solutions/currency_ex.py diff --git a/src/act4e_solutions/currency_ex.py b/src/act4e_solutions/currency_ex.py new file mode 100644 index 0000000..c0b6b1b --- /dev/null +++ b/src/act4e_solutions/currency_ex.py @@ -0,0 +1,12 @@ +import act4e_interfaces as I + + +class SolCurrencyOptimization(I.CurrencyOptimization): + def compute_optimal_conversion( + self, + available: I.SemiCategory[I.RichObject[str], I.RichMorphism[I.CurrencyExchanger]], + source: str, + amount: float, + target: str, + ) -> I.OptimalSolution: + pass -- cgit v1.2.1