Skip to content
Permalink
Browse files

feat(indexer-cli): add as_response switcher to indexer cli

  • Loading branch information...
hanxiao committed Oct 11, 2019
1 parent c880c9b commit 552fcdfe9ffe627d134221000f6f59c6196e14a9
Showing with 12 additions and 7 deletions.
  1. +2 −2 gnes/base/__init__.py
  2. +7 −3 gnes/flow/__init__.py
  3. +3 −2 gnes/indexer/base.py
@@ -247,7 +247,7 @@ def train(self, *args, **kwargs):
def dump(self, filename: str = None) -> None:
"""
Serialize the object to a binary file
:param filename: file path of the serialized file, if not given then `self.dump_full_path` is used
:param filename: file path of the serialized file, if not given then :py:attr:`dump_full_path` is used
"""
f = filename or self.dump_full_path
if not f:
@@ -260,7 +260,7 @@ def dump(self, filename: str = None) -> None:
def dump_yaml(self, filename: str = None) -> None:
"""
Serialize the object to a yaml file
:param filename: file path of the yaml file, if not given then `self.dump_yaml_path` is used
:param filename: file path of the yaml file, if not given then :py:attr:`dump_yaml_path` is used
"""
f = filename or self.yaml_full_path
if not f:
@@ -61,12 +61,14 @@ class Flow:
"""
GNES Flow: an intuitive way to build workflow for GNES.
You can use `.add()` then `.build()` to customize your own workflow.
You can use :py:meth:`.add()` then :py:meth:`.build()` to customize your own workflow.
For example:
.. highlight:: python
.. code-block:: python
from gnes.flow import Flow, Service as gfs
f = (Flow(check_version=False, route_table=True)
.add(gfs.Preprocessor, yaml_path='BasePreprocessor')
.add(gfs.Encoder, yaml_path='BaseEncoder')
@@ -76,9 +78,11 @@ class Flow:
flow.index()
...
You can also use the shortcuts, e.g. :py:meth:add_encoder , :py:meth:add_preprocessor
It is recommend to use flow in the context manner as showed above.
Note the different default copy behaviors in `.add()` and `.build()`:
`.add()` always copy the flow by default, whereas `.build()` modify the flow in place.
Note the different default copy behaviors in :py:meth:`.add()` and :py:meth:`.build()`:
:py:meth:`.add()` always copy the flow by default, whereas :py:meth:`.build()` modify the flow in place.
You can change this behavior by giving an argument `copy_flow=False`.
"""
@@ -12,9 +12,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from collections import defaultdict
from functools import wraps
from typing import List, Any, Union, Callable, Tuple
from collections import defaultdict

import numpy as np

@@ -30,7 +30,8 @@ def __init__(self,
is_big_score_similar: bool = False,
*args, **kwargs):
"""
Base indexer, a valid indexer must implement `add` and `query` methods
Base indexer, a valid indexer must implement :py:meth:`add` and :py:meth:`query` methods
:type score_fn: advanced score function
:type normalize_fn: normalizing score function
:type is_big_score_similar: when set to true, then larger score means more similar

0 comments on commit 552fcdf

Please sign in to comment.
You can’t perform that action at this time.