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