Skip to content

Commit 1d532b5

Browse files
generate types for the Elasticsearch response
1 parent 579f572 commit 1d532b5

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

elasticsearch_dsl/response/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545

4646
class Response(AttrDict[Any], Generic[_R]):
47-
"""An Elasticsearch response.
47+
"""An Elasticsearch search response.
4848
4949
:arg took: (required)
5050
:arg timed_out: (required)

utils/generator.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ def add_not_set(type_):
9999
return type_
100100

101101

102+
# def add_optional(type_):
103+
# """Add Optional to a Python type hint."""
104+
# if type_.startswith("Union["):
105+
# type_ = f"{type_[:-1]}, None]"
106+
# else:
107+
# type_ = f"Union[{type_}, None]"
108+
# return type_
109+
110+
102111
class ElasticsearchSchema:
103112
"""Operations related to the Elasticsearch schema."""
104113

utils/templates/response.__init__.py.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ __all__ = ["Response", "AggResponse", "UpdateByQueryResponse", "Hit", "HitMeta"]
4444

4545

4646
class Response(AttrDict[Any], Generic[_R]):
47-
"""An Elasticsearch _search response.
47+
"""An Elasticsearch search response.
4848

4949
{% for arg in response.args %}
5050
{% for line in arg.doc %}

0 commit comments

Comments
 (0)