diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2c6e71b03fdfbb35878963c66f30783592453968..6f9329703cfaf8a9df712b223eb1fb0ca56429ad 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,6 +34,20 @@ repos: name: black-src alias: black exclude: ^(docs/|llama_index/_static) + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.0.1 + hooks: + - id: mypy + additional_dependencies: + [ + "types-requests", + "types-Deprecated", + "types-redis", + "types-setuptools", + "types-PyYAML", + "types-protobuf", + ] + exclude: ^(docs/|llama_index/_static) - repo: https://github.com/psf/black-pre-commit-mirror rev: 23.10.1 hooks: diff --git a/llama_index/embeddings/pooling.py b/llama_index/embeddings/pooling.py index 1f046d16912f681482493ccff7a3bfe0417bf9bc..ec591af10961fcf354b333b27686e4a08f0f7528 100644 --- a/llama_index/embeddings/pooling.py +++ b/llama_index/embeddings/pooling.py @@ -25,7 +25,9 @@ class Pooling(str, Enum): @classmethod @overload - def cls_pooling(cls, array: "torch.Tensor") -> "torch.Tensor": + # TODO: Remove this `type: ignore` after the false positive problem + # is addressed in mypy: https://github.com/python/mypy/issues/15683 . + def cls_pooling(cls, array: "torch.Tensor") -> "torch.Tensor": # type: ignore ... @classmethod diff --git a/tests/vector_stores/test_elasticsearch.py b/tests/vector_stores/test_elasticsearch.py index d4b7c681b839de608257d84671368e48be233a61..18bb7f07f41a6947b580d7fd2e032c79e0f53c3f 100644 --- a/tests/vector_stores/test_elasticsearch.py +++ b/tests/vector_stores/test_elasticsearch.py @@ -87,6 +87,7 @@ def elasticsearch_connection() -> Union[dict, Generator[dict, None, None]]: if index_name.startswith("test_"): es.indices.delete(index=index_name) es.indices.refresh(index="_all") + return {} @pytest.fixture(scope="session")