Skip to content

Commit

Permalink
docs: docstring for types/score (#1903)
Browse files Browse the repository at this point in the history
  • Loading branch information
CatStark committed Feb 8, 2021
1 parent 3838392 commit 6dae7b5
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions jina/types/score/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,19 @@ class NamedScore(ProtoTypeMixin):
score_proto.value = 10.0
score = NamedScore(score_proto)
:param score: The score to construct from, depending on the ``copy``,
it builds a view or a copy from it.
:type score: Optional[jina_pb2.NamedScoreProto]
:param copy: When ``score`` is given as a :class:`NamedScoreProto` object, build a
view (i.e. weak reference) from it or a deep copy from it.
:type copy: bool
:param kwargs: Other parameters to be set
"""

def __init__(self, score: Optional[jina_pb2.NamedScoreProto] = None,
copy: bool = False, **kwargs):
"""
:param score: the score to construct from, depending on the ``copy``,
it builds a view or a copy from it.
:param copy: when ``score`` is given as a :class:`NamedScoreProto` object, build a
view (i.e. weak reference) from it or a deep copy from it.
:param kwargs: other parameters to be set
"""
"""Set constructor."""
self._pb_body = jina_pb2.NamedScoreProto()
try:
if isinstance(score, jina_pb2.NamedScoreProto):
Expand All @@ -66,19 +67,18 @@ def __init__(self, score: Optional[jina_pb2.NamedScoreProto] = None,

@property
def ref_id(self) -> str:
"""The score is computed between doc ``id`` and ``ref_id``"""
"""Returns computed score between doc ``id`` and ``ref_id``."""
return self._pb_body.ref_id

@ref_id.setter
def ref_id(self, val: str):
self._pb_body.ref_id = val

def set_attrs(self, **kwargs):
"""Bulk update Document fields with key-value specified in kwargs
"""Udate Document fields with key-value specified in kwargs.
.. seealso::
:meth:`get_attrs` for bulk get attributes
"""
for k, v in kwargs.items():
if isinstance(v, (list, tuple)):
Expand Down

0 comments on commit 6dae7b5

Please sign in to comment.