Skip to content

Commit

Permalink
style: reformat the code and imports
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao committed May 9, 2020
1 parent 2911a45 commit ef92cb1
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 13 deletions.
15 changes: 13 additions & 2 deletions docs/chapters/flow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,21 @@ input_fn = (b's' for _ in range(10))

If you don't use Python as client, or your client and flow are on different instances. You can hold a flow in running state and use client in other languages to connect to it. Simply:

```python
import threading

with f:
threading.Event().wait()
```

Please checkout https://github.com/jina-ai/examples/tree/master/helloword-in-cs for a complete example.

**WARNING**: don't use while loop to do the waiting, it is extremely low-efficient:

```python
with f:
while True:
pass
while True: # <- dont do that
pass # <- dont do that
```

## Use Flow API in YAML
Expand Down
2 changes: 1 addition & 1 deletion jina/executors/encoders/frameworks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from . import BaseEncoder
from ..decorators import batching, as_ndarray
from ..frameworks import BaseOnnxExecutor, BasePaddleExecutor, BaseTorchExecutor, BaseTFExecutor, BaseFrameworkExecutor
from ..frameworks import BaseOnnxExecutor, BasePaddleExecutor, BaseTorchExecutor, BaseTFExecutor
from ...helper import is_url


Expand Down
1 change: 1 addition & 0 deletions jina/executors/encoders/image/paddlehub.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ImagePaddlehubEncoder(BaseCVPaddlehubEncoder):
Internally, :class:`ImagePaddlehubEncoder` wraps the models from `paddlehub`.
https://github.com/PaddlePaddle/PaddleHub
"""

def __init__(self, *args, **kwargs):
"""
Expand Down
2 changes: 1 addition & 1 deletion jina/executors/encoders/image/tfkeras.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import numpy as np

from ...decorators import batching, as_ndarray
from ..frameworks import BaseCVTFEncoder
from ...decorators import batching, as_ndarray


class KerasImageEncoder(BaseCVTFEncoder):
Expand Down
2 changes: 1 addition & 1 deletion jina/executors/encoders/nlp/farm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import numpy as np

from ...decorators import batching, as_ndarray
from ..frameworks import BaseTextTorchEncoder
from ...decorators import batching, as_ndarray


class FarmTextEncoder(BaseTextTorchEncoder):
Expand Down
2 changes: 1 addition & 1 deletion jina/executors/encoders/nlp/flair.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import numpy as np

from ...decorators import batching, as_ndarray
from ..frameworks import BaseTextTorchEncoder
from ...decorators import batching, as_ndarray


class FlairTextEncoder(BaseTextTorchEncoder):
Expand Down
2 changes: 1 addition & 1 deletion jina/executors/encoders/nlp/paddlehub.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import numpy as np

from ...decorators import batching, as_ndarray
from ..frameworks import BaseTextPaddlehubEncoder
from ...decorators import batching, as_ndarray


class TextPaddlehubEncoder(BaseTextPaddlehubEncoder):
Expand Down
4 changes: 2 additions & 2 deletions jina/executors/encoders/nlp/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

import numpy as np

from .. import BaseEncoder
from ..frameworks import BaseTextTFEncoder, BaseTextTorchEncoder
from ..helper import reduce_mean, reduce_max, reduce_min, reduce_cls
from ...decorators import batching, as_ndarray
from ..frameworks import BaseTextTFEncoder, BaseTextTorchEncoder
from .. import BaseEncoder


class BaseTransformerEncoder(BaseEncoder):
Expand Down
1 change: 0 additions & 1 deletion jina/executors/encoders/video/paddlehub.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
__copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved."
__license__ = "Apache-2.0"


from ..frameworks import BaseCVPaddlehubEncoder


Expand Down
1 change: 1 addition & 0 deletions jina/executors/encoders/video/torchvision.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class VideoTorchEncoder(BaseCVTorchEncoder, BaseVideoEncoder):
Internally, :class:`VideoTorchEncoder` wraps the models from `torchvision.models`.
https://pytorch.org/docs/stable/torchvision/models.html
"""

def __init__(self, *args, **kwargs):
"""
Expand Down
1 change: 0 additions & 1 deletion jina/executors/indexers/keyvalue/leveldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Union

from google.protobuf.json_format import Parse

from jina.executors.indexers.keyvalue.proto import BasePbIndexer
from jina.executors.indexers.keyvalue.proto import jina_pb2

Expand Down
1 change: 0 additions & 1 deletion jina/executors/indexers/keyvalue/proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from typing import Union

from google.protobuf.json_format import Parse

from jina.executors.indexers import BaseKVIndexer
from jina.proto import jina_pb2

Expand Down
1 change: 0 additions & 1 deletion jina/executors/indexers/vector/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Tuple, Optional

import numpy as np

from jina.executors.indexers import BaseVectorIndexer


Expand Down

0 comments on commit ef92cb1

Please sign in to comment.