Skip to content

Commit

Permalink
D401 fixes in Pinecone provider (#37270)
Browse files Browse the repository at this point in the history
  • Loading branch information
rawwar committed Feb 9, 2024
1 parent ab9e2e1 commit 17945fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
14 changes: 7 additions & 7 deletions airflow/providers/pinecone/hooks/pinecone.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class PineconeHook(BaseHook):

@classmethod
def get_connection_form_widgets(cls) -> dict[str, Any]:
"""Returns connection widgets to add to connection form."""
"""Return connection widgets to add to connection form."""
from flask_appbuilder.fieldwidgets import BS3TextFieldWidget
from flask_babel import lazy_gettext
from wtforms import StringField
Expand All @@ -60,7 +60,7 @@ def get_connection_form_widgets(cls) -> dict[str, Any]:

@classmethod
def get_ui_field_behaviour(cls) -> dict[str, Any]:
"""Returns custom field behaviour."""
"""Return custom field behaviour."""
return {
"hidden_fields": ["port", "schema"],
"relabeling": {"login": "Pinecone Environment", "password": "Pinecone API key"},
Expand Down Expand Up @@ -108,7 +108,7 @@ def upsert(
**kwargs: Any,
) -> UpsertResponse:
"""
The upsert operation writes vectors into a namespace.
Write vectors into a namespace.
If a new value is upserted for an existing vector id, it will overwrite the previous value.
Expand Down Expand Up @@ -204,7 +204,7 @@ def delete_index(index_name: str, timeout: int | None = None) -> None:
@staticmethod
def configure_index(index_name: str, replicas: int | None = None, pod_type: str | None = "") -> None:
"""
Changes current configuration of the index.
Change the current configuration of the index.
:param index_name: The name of the index to configure.
:param replicas: The new number of replicas.
Expand Down Expand Up @@ -258,7 +258,7 @@ def query_vector(
sparse_vector: SparseValues | dict[str, list[float] | list[int]] | None = None,
) -> QueryResponse:
"""
The Query operation searches a namespace, using a query vector.
Search a namespace using query vector.
It retrieves the ids of the most similar items in a namespace, along with their similarity scores.
API reference: https://docs.pinecone.io/reference/query
Expand Down Expand Up @@ -288,7 +288,7 @@ def query_vector(

@staticmethod
def _chunks(iterable: list[Any], batch_size: int = 100) -> Any:
"""Helper function to break an iterable into chunks of size batch_size."""
"""Break an iterable into chunks of size batch_size."""
it = iter(iterable)
chunk = tuple(itertools.islice(it, batch_size))
while chunk:
Expand Down Expand Up @@ -329,7 +329,7 @@ def describe_index_stats(
**kwargs: Any,
) -> DescribeIndexStatsResponse:
"""
Describes the index statistics.
Describe the index statistics.
Returns statistics about the index's contents. For example: The vector count per
namespace and the number of dimensions.
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1546,7 +1546,6 @@ combine-as-imports = true
"airflow/providers/pagerduty/hooks/pagerduty.py" = ["D401"]
"airflow/providers/pagerduty/hooks/pagerduty_events.py" = ["D401"]
"airflow/providers/papermill/hooks/kernel.py" = ["D401"]
"airflow/providers/pinecone/hooks/pinecone.py" = ["D401"]
"airflow/providers/postgres/hooks/postgres.py" = ["D401"]
"airflow/providers/presto/hooks/presto.py" = ["D401"]
"airflow/providers/qdrant/hooks/qdrant.py" = ["D401"]
Expand Down

0 comments on commit 17945fc

Please sign in to comment.