Skip to content

Commit

Permalink
style(label): update error message for calling "dumps()" in mask label
Browse files Browse the repository at this point in the history
  • Loading branch information
zhen.chen committed Apr 11, 2022
1 parent 526a7e9 commit 9a504fc
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions tensorbay/label/label_mask.py
Expand Up @@ -355,7 +355,20 @@ def get_callback_body(self) -> Dict[str, Any]:
return body


class RemoteSemanticMask(SemanticMaskBase, RemoteFileMixin):
class RemoteMaskErrorMixin: # pylint: disable=too-few-public-methods
"""RemoteMaskErrorMixin provid more accurate error information when calling ``dumps()``."""

def get_callback_body(self) -> None:
"""``dumps`` function is not support for remote mask label.
Raises:
AttributeError: when calling the ``dumps()``.
"""
raise AttributeError(f"'{self.__class__.__name__}' object has no function 'dumps()'")


class RemoteSemanticMask(SemanticMaskBase, RemoteFileMixin, RemoteMaskErrorMixin):
"""RemoteSemanticMask is a class for the remote semantic mask label.
Attributes:
Expand Down Expand Up @@ -403,7 +416,7 @@ def from_response_body(cls: Type[_T], body: Dict[str, Any]) -> _T:
return mask


class RemoteInstanceMask(InstanceMaskBase, RemoteFileMixin):
class RemoteInstanceMask(InstanceMaskBase, RemoteFileMixin, RemoteMaskErrorMixin):
"""RemoteInstanceMask is a class for the remote instance mask label.
Attributes:
Expand Down Expand Up @@ -451,7 +464,7 @@ def from_response_body(cls: Type[_T], body: Dict[str, Any]) -> _T:
return mask


class RemotePanopticMask(PanopticMaskBase, RemoteFileMixin):
class RemotePanopticMask(PanopticMaskBase, RemoteFileMixin, RemoteMaskErrorMixin):
"""RemotePanoticMask is a class for the remote panotic mask label.
Attributes:
Expand Down

0 comments on commit 9a504fc

Please sign in to comment.