From 565f5ad84bf1006659047c8d23014b5b0502b03a Mon Sep 17 00:00:00 2001 From: Jun Ohtani Date: Fri, 7 Jul 2023 12:11:37 +0900 Subject: [PATCH] =?UTF-8?q?pre-commit=E3=81=A7=E5=88=A9=E7=94=A8=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=83=84=E3=83=BC=E3=83=AB=E3=82=92=E3=83=AD=E3=83=BC?= =?UTF-8?q?=E3=82=AB=E3=83=AB=E3=81=AE=E3=82=82=E3=81=AE=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=20mypy=E3=81=A7=E6=A4=9C=E7=9F=A5=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=9F=E3=82=A8=E3=83=A9=E3=83=BC=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 33 +++++++++++++++++++++------------ backend/es/indexer.py | 2 +- poetry.lock | 18 +++++++++++++++++- pyproject.toml | 4 +++- 4 files changed, 42 insertions(+), 15 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 96dbb5a..4a57112 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,27 @@ repos: - - repo: https://github.com/psf/black - rev: 23.3.0 + - repo: local hooks: - id: black - - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 - hooks: + name: black + entry: black + language: system + types: + - python - id: flake8 - additional_dependencies: [flake8-pyproject] - - repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: + name: flake8 + entry: flake8 + language: system + types: + - python - id: isort - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.4.1 - hooks: + name: isort + entry: isort + language: system + types: + - python - id: mypy + name: mypy + entry: mypy + language: system + types: + - python diff --git a/backend/es/indexer.py b/backend/es/indexer.py index 83eebc2..aaa0ad0 100644 --- a/backend/es/indexer.py +++ b/backend/es/indexer.py @@ -29,7 +29,7 @@ def load_schema_from_file(self) -> dict: return schema def is_exist_index(self) -> bool: - return self.esclient.indices.exists(index=self.config.index) + return self.esclient.indices.exists(index=self.config.index).body def delete_index(self): self.esclient.indices.delete(index=self.config.index) diff --git a/poetry.lock b/poetry.lock index 5aa541c..0327a14 100644 --- a/poetry.lock +++ b/poetry.lock @@ -825,6 +825,22 @@ mccabe = ">=0.7.0,<0.8.0" pycodestyle = ">=2.10.0,<2.11.0" pyflakes = ">=3.0.0,<3.1.0" +[[package]] +name = "flake8-pyproject" +version = "1.2.3" +description = "Flake8 plug-in loading the configuration from pyproject.toml" +optional = false +python-versions = ">= 3.6" +files = [ + {file = "flake8_pyproject-1.2.3-py3-none-any.whl", hash = "sha256:6249fe53545205af5e76837644dc80b4c10037e73a0e5db87ff562d75fb5bd4a"}, +] + +[package.dependencies] +Flake8 = ">=5" + +[package.extras] +dev = ["pyTest", "pyTest-cov"] + [[package]] name = "fqdn" version = "1.5.1" @@ -3679,4 +3695,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "8bb3812b8cdb937bd21f77642e9dd301295d9fc49764de20b3338f6f9e4d9c17" +content-hash = "605d978a340913b619d30559392ff8503ac76142d29af02602db85f7a967fe88" diff --git a/pyproject.toml b/pyproject.toml index c267504..bd0ffd4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ black = "^23.3.0" flake8 = "^6.0.0" isort = "^5.12.0" mypy = "^1.4.1" +flake8-pyproject = "^1.2.3" [build-system] requires = ["poetry-core"] @@ -41,4 +42,5 @@ multi_line_output = 3 [tool.flake8] max_line_length = 120 -[tool.mypy] \ No newline at end of file +[tool.mypy] +ignore_missing_imports = true \ No newline at end of file