summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Censi <acensi@ethz.ch>2022-02-22 20:03:13 +0100
committerAndrea Censi <acensi@ethz.ch>2022-02-22 20:03:13 +0100
commit33765315bc7c41be459766ee461effc4b8b841c7 (patch)
treedb88a0edabf62b3031a4cde121933f67ce11e2a2
parentmisc (diff)
parentsettings (diff)
downloadact4e-33765315bc7c41be459766ee461effc4b8b841c7.tar.gz
act4e-33765315bc7c41be459766ee461effc4b8b841c7.zip
merge
-rw-r--r--.devcontainer/Dockerfile24
-rw-r--r--.devcontainer/devcontainer.json53
-rw-r--r--.gitignore4
-rw-r--r--.pre-commit-config.yaml47
-rw-r--r--.pylintrc7
-rw-r--r--.vscode/settings.json6
-rw-r--r--Makefile10
-rw-r--r--README.md32
-rw-r--r--requirements.txt2
-rw-r--r--src/act4e_solutions/maps_representation.py2
-rw-r--r--src/act4e_solutions/posets_bounds.py1
-rw-r--r--src/act4e_solutions/posets_representation.py1
-rw-r--r--src/act4e_solutions/relations_representation.py1
-rw-r--r--src/act4e_solutions/semigroups_representation.py1
-rw-r--r--src/act4e_solutions/sets_properties.py2
-rw-r--r--src/act4e_solutions/sets_representation.py2
16 files changed, 162 insertions, 33 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
new file mode 100644
index 0000000..f50f4d2
--- /dev/null
+++ b/.devcontainer/Dockerfile
@@ -0,0 +1,24 @@
+# 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
+
+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 \
+ && 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 <your-package-list-here>
+
+# [Optional] Uncomment this line to install global node packages.
+# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1 \ No newline at end of file
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 0000000..c3fc20e
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,53 @@
+// 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-bullseye",
+ // Options
+ "NODE_VERSION": "none"
+ }
+ },
+
+ // Set *default* container specific settings.json values on container create.
+ "settings": {
+ "python.defaultInterpreterPath": "/usr/local/bin/python",
+ "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",
+ "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",
+ "tht13.html-preview-vscode",
+ // "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/.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/.pre-commit-config.yaml b/.pre-commit-config.yaml
index a5c6e90..f4adb4c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,23 +1,28 @@
-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
+- 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 1b050e28e72b639bc7781ce39208defb
+ 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: 22.1.0
+ hooks:
+ - id: black
+ args: [-l, '110']
+- 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]
+files: (^src/.*py)|(.*yaml)
diff --git a/.pylintrc b/.pylintrc
new file mode 100644
index 0000000..d13ca13
--- /dev/null
+++ b/.pylintrc
@@ -0,0 +1,7 @@
+[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
+ R0903, # too few public methods \ No newline at end of file
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
diff --git a/Makefile b/Makefile
index 5177571..3090a59 100644
--- a/Makefile
+++ b/Makefile
@@ -5,13 +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 $*
+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
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..5bb6b79
--- /dev/null
+++ b/README.md
@@ -0,0 +1,32 @@
+
+
+## Setup
+
+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.
+
+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..
+
+
+
diff --git a/requirements.txt b/requirements.txt
index e69de29..28fee9e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -0,0 +1,2 @@
+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 eef9c96..99147cd 100644
--- a/src/act4e_solutions/posets_bounds.py
+++ b/src/act4e_solutions/posets_bounds.py
@@ -35,7 +35,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]: