Skip to content

Commit

Permalink
minor typing updates
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Oct 18, 2024
1 parent c43c5e3 commit 118ff63
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
4 changes: 2 additions & 2 deletions elasticsearch_dsl/document_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def __init__(self, name: str, bases: Tuple[type, ...], attrs: Dict[str, Any]):
fields.update(annotations.keys())
field_defaults = {}
for name in fields:
value = None
value: Any = None
required = None
multi = None
if name in annotations:
Expand Down Expand Up @@ -201,7 +201,7 @@ def __init__(self, name: str, bases: Tuple[type, ...], attrs: Dict[str, Any]):
field_args = [type_]
elif type_ in self.type_annotation_map:
# use best field type for the type hint provided
field, field_kwargs = self.type_annotation_map[type_]
field, field_kwargs = self.type_annotation_map[type_] # type: ignore

if field:
field_kwargs = {
Expand Down
9 changes: 0 additions & 9 deletions utils/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,6 @@ def add_not_set(type_):
return type_


# def add_optional(type_):
# """Add Optional to a Python type hint."""
# if type_.startswith("Union["):
# type_ = f"{type_[:-1]}, None]"
# else:
# type_ = f"Union[{type_}, None]"
# return type_


class ElasticsearchSchema:
"""Operations related to the Elasticsearch schema."""

Expand Down
2 changes: 1 addition & 1 deletion utils/templates/response.__init__.py.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class AggResponse(AttrDict[Any], Generic[_R]):


class UpdateByQueryResponse(AttrDict[Any], Generic[_R]):
"""An Elasticsearch response.
"""An Elasticsearch update by query response.

{% for arg in ubq_response.args %}
{% for line in arg.doc %}
Expand Down

0 comments on commit 118ff63

Please sign in to comment.