Skip to content

Commit

Permalink
Don't use recursive type references, due to ugly syntax and incompata…
Browse files Browse the repository at this point in the history
…bility with union operator
  • Loading branch information
jonathangreen committed May 14, 2024
1 parent 5d20a43 commit 1a02e63
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/palace/manager/search/document.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
from __future__ import annotations

from abc import ABC, abstractmethod
from collections.abc import Mapping
from typing import Any

SearchMappingSerialization = Mapping[
str, "str | bool | Sequence[str] | SearchMappingSerialization"
]
SearchMappingSerialization = dict[str, Any]


class SearchMappingFieldType(ABC):
Expand Down Expand Up @@ -193,7 +191,7 @@ def __init__(self) -> None:

def serialize(self) -> SearchMappingSerialization:
output = self._basic.serialize()
output["fields"]["keyword"] = { # type: ignore[index]
output["fields"]["keyword"] = {
"type": "keyword",
"index": True,
"store": False,
Expand Down
2 changes: 1 addition & 1 deletion src/palace/manager/search/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def from_bulk_error(cls, error: dict[str, Any]) -> SearchServiceFailedDocument:
)


SearchDocument = dict[str, "str | int | bool | None | Sequence[str] | SearchDocument"]
SearchDocument = dict[str, Any]


class SearchService(ABC):
Expand Down

0 comments on commit 1a02e63

Please sign in to comment.