From 14dc7b79876a6b6ea8f5fc3bb71ae54181af76e5 Mon Sep 17 00:00:00 2001 From: Alessandro De Maria Date: Mon, 5 Feb 2024 08:01:25 +0000 Subject: [PATCH] fix lint --- .github/workflows/python-lint-test.yml | 2 +- .pre-commit-config.yaml | 23 +++++++++++++++++++++++ kadet/__init__.py | 11 +++++++++-- tests/test_multidoc.py | 1 + tests/test_sha256.py | 1 + 5 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/python-lint-test.yml b/.github/workflows/python-lint-test.yml index 64cdc7a..3e966aa 100644 --- a/.github/workflows/python-lint-test.yml +++ b/.github/workflows/python-lint-test.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: ['3.10', '3.11'] steps: - uses: actions/checkout@v2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..f377fa2 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,23 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: trailing-whitespace + - id: check-docstring-first + - id: debug-statements + - id: end-of-file-fixer + - id: requirements-txt-fixer + - id: check-merge-conflict + - repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black + - repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort + args: [--profile, black] + - repo: meta + hooks: + - id: check-useless-excludes diff --git a/kadet/__init__.py b/kadet/__init__.py index a058392..c5f6198 100644 --- a/kadet/__init__.py +++ b/kadet/__init__.py @@ -8,7 +8,8 @@ import yaml from box import Box, BoxList -from pydantic import ConfigDict, BaseModel as PydanticBaseModel +from pydantic import BaseModel as PydanticBaseModel +from pydantic import ConfigDict from typeguard import check_type ABORT_EXCEPTION_TYPE = ValueError @@ -252,6 +253,12 @@ def _dump(self, obj): def dump(self): """Return object dict/list.""" return self._dump(self) + # TODO[pydantic]: The following keys were removed: `copy_on_model_validation`, `underscore_attrs_are_private`. # Check https://docs.pydantic.dev/dev-v2/migration/#changes-to-config for more information. - model_config = ConfigDict(arbitrary_types_allowed=True, copy_on_model_validation=False, underscore_attrs_are_private=True, extra="allow") + model_config = ConfigDict( + arbitrary_types_allowed=True, + copy_on_model_validation=False, + underscore_attrs_are_private=True, + extra="allow", + ) diff --git a/tests/test_multidoc.py b/tests/test_multidoc.py index ccce45a..a65c32e 100644 --- a/tests/test_multidoc.py +++ b/tests/test_multidoc.py @@ -8,6 +8,7 @@ "multidoc tests" import unittest + from kadet import BaseObj diff --git a/tests/test_sha256.py b/tests/test_sha256.py index dee9dbd..217d445 100644 --- a/tests/test_sha256.py +++ b/tests/test_sha256.py @@ -8,6 +8,7 @@ "sha256 tests" import unittest + from kadet import BaseObj