From 85b67ede85da329bd806400a8c5311b4f789d738 Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Tue, 5 Nov 2024 19:02:23 +0000 Subject: [PATCH] type ignores for pipe syntax in 3.8/3.9 --- elasticsearch_dsl/document_base.py | 2 +- elasticsearch_dsl/response/__init__.py | 2 +- tests/_async/test_document.py | 8 ++++---- tests/_sync/test_document.py | 8 ++++---- utils/templates/response.__init__.py.tpl | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/elasticsearch_dsl/document_base.py b/elasticsearch_dsl/document_base.py index e71bd689..a26aff22 100644 --- a/elasticsearch_dsl/document_base.py +++ b/elasticsearch_dsl/document_base.py @@ -33,7 +33,7 @@ ) try: - from types import UnionType + from types import UnionType # type: ignore[attr-defined] except ImportError: UnionType = None diff --git a/elasticsearch_dsl/response/__init__.py b/elasticsearch_dsl/response/__init__.py index 51c24ff9..a711950f 100644 --- a/elasticsearch_dsl/response/__init__.py +++ b/elasticsearch_dsl/response/__init__.py @@ -44,7 +44,7 @@ class Response(AttrDict[Any], Generic[_R]): - """An Elasticsearch response. + """An Elasticsearch _search response. :arg took: (required) :arg timed_out: (required) diff --git a/tests/_async/test_document.py b/tests/_async/test_document.py index 82568762..b00b7822 100644 --- a/tests/_async/test_document.py +++ b/tests/_async/test_document.py @@ -790,13 +790,13 @@ def test_doc_with_pipe_type_hints() -> None: class BadlyTypedDoc(AsyncDocument): s: str - f: str | int | None + f: str | int | None # type: ignore[syntax] class TypedDoc(AsyncDocument): s: str - f1: str | None - f2: M[int | None] - f3: M[datetime | None] + f1: str | None # type: ignore[syntax] + f2: M[int | None] # type: ignore[syntax] + f3: M[datetime | None] # type: ignore[syntax] props = TypedDoc._doc_type.mapping.to_dict()["properties"] assert props == { diff --git a/tests/_sync/test_document.py b/tests/_sync/test_document.py index 33dd9f37..c00ec195 100644 --- a/tests/_sync/test_document.py +++ b/tests/_sync/test_document.py @@ -790,13 +790,13 @@ def test_doc_with_pipe_type_hints() -> None: class BadlyTypedDoc(Document): s: str - f: str | int | None + f: str | int | None # type: ignore[syntax] class TypedDoc(Document): s: str - f1: str | None - f2: M[int | None] - f3: M[datetime | None] + f1: str | None # type: ignore[syntax] + f2: M[int | None] # type: ignore[syntax] + f3: M[datetime | None] # type: ignore[syntax] props = TypedDoc._doc_type.mapping.to_dict()["properties"] assert props == { diff --git a/utils/templates/response.__init__.py.tpl b/utils/templates/response.__init__.py.tpl index 5d5d7bac..a3812616 100644 --- a/utils/templates/response.__init__.py.tpl +++ b/utils/templates/response.__init__.py.tpl @@ -44,7 +44,7 @@ __all__ = ["Response", "AggResponse", "UpdateByQueryResponse", "Hit", "HitMeta"] class Response(AttrDict[Any], Generic[_R]): - """An Elasticsearch _search response. + """An Elasticsearch search response. {% for arg in response.args %} {% for line in arg.doc %}