Fix mypy type errors for elasticsearch-python v8.0.0

This commit is contained in:
David Kyle 2022-03-08 23:50:39 +00:00 committed by GitHub
parent 5c5e5af54d
commit 5678525b15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union, cast
from typing import TYPE_CHECKING, Any, Dict, List, Mapping, Optional, Tuple, Union, cast
import elasticsearch
import numpy as np
@ -129,7 +129,7 @@ class MLModel:
>>> # Delete model from Elasticsearch
>>> es_model.delete_model()
"""
docs = []
docs: List[Mapping[str, Any]] = []
if isinstance(X, np.ndarray):
def to_list_or_float(x: Any) -> Union[List[Any], float]:

View File

@ -19,7 +19,7 @@ import base64
import json
import math
import os
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Set, Tuple, Union
from typing import TYPE_CHECKING, Any, Iterable, List, Mapping, Set, Tuple, Union
from tqdm.auto import tqdm # type: ignore
@ -96,7 +96,7 @@ class PyTorchModel:
def infer(
self,
docs: List[Dict[str, str]],
docs: List[Mapping[str, str]],
timeout: str = DEFAULT_TIMEOUT,
) -> Any:
return self._client.options(