Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jina-ai/jina into test-ge…
Browse files Browse the repository at this point in the history
…t-content
  • Loading branch information
JoanFM committed Mar 8, 2021
2 parents 78238ac + caae3f6 commit 89c61a9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
8 changes: 3 additions & 5 deletions jina/clients/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
__copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"

from typing import Iterable

from . import request
from .base import BaseClient, CallbackFnType, InputType
from .base import BaseClient, CallbackFnType, InputType, InputDeleteType
from .helper import callback_exec
from .request import GeneratorSourceType
from .websocket import WebSocketClientMixin
Expand Down Expand Up @@ -149,15 +147,15 @@ def update(
)
def delete(
self,
inputs: Iterable[str],
inputs: InputDeleteType,
on_done: CallbackFnType = None,
on_error: CallbackFnType = None,
on_always: CallbackFnType = None,
**kwargs
) -> None:
"""Issue 'update' request to the Flow.
:param inputs: input data which can be an Iterable, a function which returns an Iterable, or a single Document
:param inputs: input data which can be an Iterable, a function which returns an Iterable, or a single Document id.
:param on_done: the function to be called when the :class:`Request` object is resolved.
:param on_error: the function to be called when the :class:`Request` object is rejected.
:param on_always: the function to be called when the :class:`Request` object is is either resolved or rejected.
Expand Down
7 changes: 3 additions & 4 deletions jina/clients/asyncio.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Module wrapping AsyncIO ops for clients."""
from typing import Iterable

from .base import InputType, BaseClient, CallbackFnType
from .base import InputType, InputDeleteType, BaseClient, CallbackFnType
from .websocket import WebSocketClientMixin
from ..enums import RequestType
from ..helper import deprecated_alias
Expand Down Expand Up @@ -147,15 +146,15 @@ async def index(
)
async def delete(
self,
inputs: Iterable[str],
inputs: InputDeleteType,
on_done: CallbackFnType = None,
on_error: CallbackFnType = None,
on_always: CallbackFnType = None,
**kwargs
) -> None:
"""Issue 'delete' request to the Flow.
:param inputs: input data which can be an Iterable, a function which returns an Iterable, or a single Document
:param inputs: input data which can be an Iterable, a function which returns an Iterable, or a single Document id
:param on_done: the function to be called when the :class:`Request` object is resolved.
:param on_error: the function to be called when the :class:`Request` object is rejected.
:param on_always: the function to be called when the :class:`Request` object is is either resolved or rejected.
Expand Down
3 changes: 2 additions & 1 deletion jina/clients/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import argparse
import os
from typing import Callable, Union, Optional, Iterator, Dict, AsyncIterator
from typing import Callable, Union, Optional, Iterator, Iterable, Dict, AsyncIterator
import asyncio

import grpc
Expand All @@ -20,6 +20,7 @@
from ..types.request import Request

InputType = Union[GeneratorSourceType, Callable[..., GeneratorSourceType]]
InputDeleteType = Union[str, Iterable[str], Callable[..., Iterable[str]]]
CallbackFnType = Optional[Callable[..., None]]


Expand Down
4 changes: 2 additions & 2 deletions jina/flow/mixin/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import numpy as np

from ...clients.base import InputType, CallbackFnType
from ...clients.base import InputType, InputDeleteType, CallbackFnType
from ...enums import DataInputType
from ...helper import deprecated_alias

Expand Down Expand Up @@ -520,7 +520,7 @@ def update(

def delete(
self,
ids: Iterable[str],
ids: InputDeleteType,
on_done: CallbackFnType = None,
on_error: CallbackFnType = None,
on_always: CallbackFnType = None,
Expand Down

0 comments on commit 89c61a9

Please sign in to comment.