Skip to content

Commit

Permalink
refactor(client): adjust the repr config of class diff
Browse files Browse the repository at this point in the history
PR Closed: #936
  • Loading branch information
rexzheng324-c committed Aug 17, 2021
1 parent ad54500 commit 1019d02
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tensorbay/client/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
AttrsMixin,
NameMixin,
ReprMixin,
ReprType,
SortedNameList,
UserSequence,
attr,
Expand Down Expand Up @@ -121,12 +122,17 @@ class DataDiff(DiffBase):

_T = TypeVar("_T", bound="DataDiff")

_repr_attrs = ("remote_path", "action")
_repr_attrs = ("action", "file", "label")

_repr_maxlevel = 2

remote_path: str = attr(key=camel)
file: FileDiff = attr()
label: LabelDiff = attr()

def _repr_head(self) -> str:
return f'{self.__class__.__name__}("{self.remote_path}")'

@classmethod
def loads(cls: Type[_T], contents: Dict[str, Any]) -> _T:
"""Loads a :class:`DataDiff` instance from the given contents.
Expand Down Expand Up @@ -199,6 +205,8 @@ class DatasetDiff(Sequence[SegmentDiff], NameMixin): # pylint: disable=too-many
"""

_repr_type = ReprType.SEQUENCE

def __init__(self, name: str, segments: PagingList[SegmentDiff]) -> None:
super().__init__(name)

Expand Down

0 comments on commit 1019d02

Please sign in to comment.