Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
feat(indexer-cli): add as_response switcher to indexer cli
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Oct 11, 2019
1 parent c880c9b commit 552fcdf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions gnes/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
10 changes: 7 additions & 3 deletions gnes/flow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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`.
"""
Expand Down
5 changes: 3 additions & 2 deletions gnes/indexer/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 552fcdf

Please sign in to comment.