Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 committed Sep 25, 2024
1 parent 1f8fb44 commit 6f49997
Show file tree
Hide file tree
Showing 56 changed files with 50 additions and 84 deletions.
4 changes: 2 additions & 2 deletions integrations/chroma/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ dependencies = [
]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = ["ruff check {args:. --exclude tests/}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/}", "style"]
style = ["ruff check {args:.}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"]
all = ["style", "typing"]

[tool.hatch.metadata]
Expand Down
4 changes: 2 additions & 2 deletions integrations/cohere/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = [
"ruff check {args:. --exclude tests/}",
"ruff check {args:}",
"black --check --diff {args:.}",
]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/}", "style"]
fmt = ["black {args:.}", "ruff check --fix {args:}", "style"]
all = ["style", "typing"]

[tool.black]
Expand Down
1 change: 0 additions & 1 deletion integrations/cohere/tests/test_cohere_chat_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from haystack.components.generators.utils import print_streaming_chunk
from haystack.dataclasses import ChatMessage, ChatRole, StreamingChunk
from haystack.utils import Secret

from haystack_integrations.components.generators.cohere import CohereChatGenerator

pytestmark = pytest.mark.chat_generators
Expand Down
1 change: 0 additions & 1 deletion integrations/cohere/tests/test_cohere_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from cohere.core import ApiError
from haystack.components.generators.utils import print_streaming_chunk
from haystack.utils import Secret

from haystack_integrations.components.generators.cohere import CohereGenerator

pytestmark = pytest.mark.generators
Expand Down
1 change: 0 additions & 1 deletion integrations/cohere/tests/test_cohere_ranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pytest
from haystack import Document
from haystack.utils.auth import Secret

from haystack_integrations.components.rankers.cohere import CohereRanker

pytestmark = pytest.mark.ranker
Expand Down
1 change: 0 additions & 1 deletion integrations/cohere/tests/test_document_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import pytest
from haystack import Document
from haystack.utils import Secret

from haystack_integrations.components.embedders.cohere import CohereDocumentEmbedder

pytestmark = pytest.mark.embedders
Expand Down
1 change: 0 additions & 1 deletion integrations/cohere/tests/test_text_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import pytest
from haystack.utils import Secret

from haystack_integrations.components.embedders.cohere import CohereTextEmbedder

pytestmark = pytest.mark.embedders
Expand Down
4 changes: 2 additions & 2 deletions integrations/elasticsearch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ detached = true
dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = ["ruff check {args:. --exclude tests/}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/}", "style"]
style = ["ruff check {args:}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:}", "style"]
all = ["style", "typing"]

[tool.hatch.metadata]
Expand Down
1 change: 0 additions & 1 deletion integrations/elasticsearch/tests/test_bm25_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import pytest
from haystack.dataclasses import Document
from haystack.document_stores.types import FilterPolicy

from haystack_integrations.components.retrievers.elasticsearch import ElasticsearchBM25Retriever
from haystack_integrations.document_stores.elasticsearch import ElasticsearchDocumentStore

Expand Down
1 change: 0 additions & 1 deletion integrations/elasticsearch/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from haystack.document_stores.errors import DocumentStoreError, DuplicateDocumentError
from haystack.document_stores.types import DuplicatePolicy
from haystack.testing.document_store import DocumentStoreBaseTests

from haystack_integrations.document_stores.elasticsearch import ElasticsearchDocumentStore


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import pytest
from haystack.dataclasses import Document
from haystack.document_stores.types import FilterPolicy

from haystack_integrations.components.retrievers.elasticsearch import ElasticsearchEmbeddingRetriever
from haystack_integrations.document_stores.elasticsearch import ElasticsearchDocumentStore

Expand Down
1 change: 0 additions & 1 deletion integrations/elasticsearch/tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# SPDX-License-Identifier: Apache-2.0
import pytest
from haystack.errors import FilterError

from haystack_integrations.document_stores.elasticsearch.filters import _normalize_filters, _normalize_ranges

filters_data = [
Expand Down
4 changes: 2 additions & 2 deletions integrations/fastembed/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ detached = true
dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243", "numpy"]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = ["ruff check {args:. --exclude tests/, examples/}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/, examples/}", "style"]
style = ["ruff check {args:.}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"]
all = ["style", "typing"]

[tool.black]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import numpy as np
import pytest
from haystack import Document, default_from_dict

from haystack_integrations.components.embedders.fastembed.fastembed_document_embedder import (
FastembedDocumentEmbedder,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pytest
from haystack import Document, default_from_dict
from haystack.dataclasses.sparse_embedding import SparseEmbedding

from haystack_integrations.components.embedders.fastembed.fastembed_sparse_document_embedder import (
FastembedSparseDocumentEmbedder,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pytest
from haystack import default_from_dict
from haystack.dataclasses.sparse_embedding import SparseEmbedding

from haystack_integrations.components.embedders.fastembed.fastembed_sparse_text_embedder import (
FastembedSparseTextEmbedder,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import numpy as np
import pytest
from haystack import default_from_dict

from haystack_integrations.components.embedders.fastembed.fastembed_text_embedder import (
FastembedTextEmbedder,
)
Expand Down
4 changes: 2 additions & 2 deletions integrations/instructor_embedders/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]

[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = ["ruff check {args:. --exclude tests/}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/}", "style"]
style = ["ruff check {args:}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:}", "style"]
all = ["style", "typing"]

[tool.coverage.run]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from unittest.mock import patch

from haystack.utils.auth import Secret

from haystack_integrations.components.embedders.instructor_embedders.embedding_backend.instructor_backend import (
_InstructorEmbeddingBackendFactory,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pytest
from haystack import Document
from haystack.utils import ComponentDevice, Secret

from haystack_integrations.components.embedders.instructor_embedders import InstructorDocumentEmbedder


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import numpy as np
import pytest
from haystack.utils import ComponentDevice, Secret

from haystack_integrations.components.embedders.instructor_embedders import InstructorTextEmbedder


Expand Down
4 changes: 2 additions & 2 deletions integrations/jina/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ detached = true
dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = ["ruff check {args:. --exclude tests/}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/}", "style"]
style = ["ruff check {args:}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:}", "style"]
all = ["style", "typing"]

[tool.black]
Expand Down
1 change: 0 additions & 1 deletion integrations/jina/tests/test_document_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import requests
from haystack import Document
from haystack.utils import Secret

from haystack_integrations.components.embedders.jina import JinaDocumentEmbedder


Expand Down
1 change: 0 additions & 1 deletion integrations/jina/tests/test_ranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import requests
from haystack import Document
from haystack.utils import Secret

from haystack_integrations.components.rankers.jina import JinaRanker


Expand Down
1 change: 0 additions & 1 deletion integrations/jina/tests/test_text_embedder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import pytest
import requests
from haystack.utils import Secret

from haystack_integrations.components.embedders.jina import JinaTextEmbedder


Expand Down
4 changes: 2 additions & 2 deletions integrations/langfuse/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]

[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = ["ruff check {args:. --exclude tests/}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/}", "style"]
style = ["ruff check {args:}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:}", "style"]
all = ["style", "typing"]

[tool.hatch.metadata]
Expand Down
4 changes: 2 additions & 2 deletions integrations/llama_cpp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]

[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = ["ruff check {args:. --exclude tests/, examples/}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/, examples/}", "style"]
style = ["ruff check {args:.}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"]
all = ["style", "typing"]

[tool.hatch.metadata]
Expand Down
1 change: 0 additions & 1 deletion integrations/llama_cpp/tests/test_chat_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from haystack.components.retrievers.in_memory import InMemoryBM25Retriever
from haystack.dataclasses import ChatMessage, ChatRole
from haystack.document_stores.in_memory import InMemoryDocumentStore

from haystack_integrations.components.generators.llama_cpp.chat.chat_generator import (
LlamaCppChatGenerator,
_convert_message_to_llamacpp_format,
Expand Down
1 change: 0 additions & 1 deletion integrations/llama_cpp/tests/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from haystack.components.builders.prompt_builder import PromptBuilder
from haystack.components.retrievers.in_memory import InMemoryBM25Retriever
from haystack.document_stores.in_memory import InMemoryDocumentStore

from haystack_integrations.components.generators.llama_cpp import LlamaCppGenerator


Expand Down
4 changes: 2 additions & 2 deletions integrations/mistral/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = [
"ruff check {args:. --exclude tests/}",
"ruff check {args:}",
"black --check --diff {args:.}",
]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/}", "style"]
fmt = ["black {args:.}", "ruff check --fix {args:}", "style"]
all = ["style", "typing"]

[tool.black]
Expand Down
4 changes: 2 additions & 2 deletions integrations/mongodb_atlas/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ detached = true
dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = ["ruff check {args:. --exclude tests/, examples/}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/, examples/}", "style"]
style = ["ruff check {args:.}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"]
all = ["style", "typing"]

[tool.black]
Expand Down
4 changes: 2 additions & 2 deletions integrations/nvidia/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = [
"ruff check {args:. --exclude tests/}",
"ruff check {args:}",
"black --check --diff {args:.}",
]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/}", "style"]
fmt = ["black {args:.}", "ruff check --fix {args:}", "style"]
all = ["style", "typing"]

[tool.black]
Expand Down
4 changes: 2 additions & 2 deletions integrations/opensearch/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ detached = true
dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243", "boto3"]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = ["ruff check {args:. --exclude tests/}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/}", "style"]
style = ["ruff check {args:}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:}", "style"]
all = ["style", "typing"]

[tool.hatch.metadata]
Expand Down
3 changes: 1 addition & 2 deletions integrations/opensearch/tests/test_auth.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from unittest.mock import Mock, patch

import pytest
from opensearchpy import Urllib3AWSV4SignerAuth

from haystack_integrations.document_stores.opensearch.auth import AWSAuth
from opensearchpy import Urllib3AWSV4SignerAuth


class TestAWSAuth:
Expand Down
1 change: 0 additions & 1 deletion integrations/opensearch/tests/test_bm25_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import pytest
from haystack.dataclasses import Document
from haystack.document_stores.types import FilterPolicy

from haystack_integrations.components.retrievers.opensearch import OpenSearchBM25Retriever
from haystack_integrations.document_stores.opensearch import OpenSearchDocumentStore
from haystack_integrations.document_stores.opensearch.document_store import DEFAULT_MAX_CHUNK_BYTES
Expand Down
3 changes: 1 addition & 2 deletions integrations/opensearch/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
from haystack.document_stores.types import DuplicatePolicy
from haystack.testing.document_store import DocumentStoreBaseTests
from haystack.utils.auth import Secret
from opensearchpy.exceptions import RequestError

from haystack_integrations.document_stores.opensearch import OpenSearchDocumentStore
from haystack_integrations.document_stores.opensearch.auth import AWSAuth
from haystack_integrations.document_stores.opensearch.document_store import DEFAULT_MAX_CHUNK_BYTES
from opensearchpy.exceptions import RequestError


@patch("haystack_integrations.document_stores.opensearch.document_store.OpenSearch")
Expand Down
1 change: 0 additions & 1 deletion integrations/opensearch/tests/test_embedding_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import pytest
from haystack.dataclasses import Document
from haystack.document_stores.types import FilterPolicy

from haystack_integrations.components.retrievers.opensearch import OpenSearchEmbeddingRetriever
from haystack_integrations.document_stores.opensearch import OpenSearchDocumentStore
from haystack_integrations.document_stores.opensearch.document_store import DEFAULT_MAX_CHUNK_BYTES
Expand Down
1 change: 0 additions & 1 deletion integrations/opensearch/tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# SPDX-License-Identifier: Apache-2.0
import pytest
from haystack.errors import FilterError

from haystack_integrations.document_stores.opensearch.filters import _normalize_ranges, normalize_filters

filters_data = [
Expand Down
4 changes: 2 additions & 2 deletions integrations/pgvector/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ detached = true
dependencies = ["black>=23.1.0", "mypy>=1.0.0", "ruff>=0.0.243"]
[tool.hatch.envs.lint.scripts]
typing = "mypy --install-types --non-interactive --explicit-package-bases {args:src/ tests}"
style = ["ruff check {args:. --exclude tests/, examples/}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:. --exclude tests/, examples/}", "style"]
style = ["ruff check {args:.}", "black --check --diff {args:.}"]
fmt = ["black {args:.}", "ruff check --fix {args:.}", "style"]
all = ["style", "typing"]

[tool.black]
Expand Down
1 change: 0 additions & 1 deletion integrations/pgvector/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from unittest.mock import patch

import pytest

from haystack_integrations.document_stores.pgvector import PgvectorDocumentStore


Expand Down
3 changes: 1 addition & 2 deletions integrations/pgvector/tests/test_document_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
from haystack.document_stores.types import DuplicatePolicy
from haystack.testing.document_store import CountDocumentsTest, DeleteDocumentsTest, WriteDocumentsTest
from haystack.utils import Secret
from pandas import DataFrame

from haystack_integrations.document_stores.pgvector import PgvectorDocumentStore
from pandas import DataFrame


@pytest.mark.integration
Expand Down
3 changes: 1 addition & 2 deletions integrations/pgvector/tests/test_embedding_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

import pytest
from haystack.dataclasses.document import Document
from numpy.random import rand

from haystack_integrations.document_stores.pgvector import PgvectorDocumentStore
from numpy.random import rand


@pytest.mark.integration
Expand Down
Loading

0 comments on commit 6f49997

Please sign in to comment.