Skip to content

Commit

Permalink
fix(client): fix the typo of "params" and adjust the limit in diff api
Browse files Browse the repository at this point in the history
PR Closed: #935
  • Loading branch information
rexzheng324-c committed Aug 16, 2021
1 parent bd25357 commit 19322db
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tensorbay/client/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def _generate_segments(
return response["totalCount"] # type: ignore[no-any-return]

def _generate_segment_diffs(
self, basehead: str, offset: int = 0, limit: int = 128
self, basehead: str, offset: int = 0, limit: int = 10
) -> Generator[SegmentDiff, None, int]:
params: Dict[str, Any] = {"offset": offset, "limit": limit}

Expand All @@ -311,12 +311,12 @@ def _generate_segment_diffs(
return response["totalCount"] # type: ignore[no-any-return]

def _generate_data_diffs(
self, basehead: str, segment_name: str, offset: int = 0, limit: int = 128
self, basehead: str, segment_name: str, offset: int = 0, limit: int = 10
) -> Generator[DataDiff, None, int]:
params: Dict[str, Any] = {"offset": offset, "limit": limit}

response = self._client.open_api_do(
"GET", f"diffs/{basehead}/segments/{segment_name}/data", self._dataset_id, param=params
"GET", f"diffs/{basehead}/segments/{segment_name}/data", self._dataset_id, params=params
).json()

for data in response["data"]:
Expand All @@ -327,7 +327,7 @@ def _generate_data_diffs(
def _list_data_diffs(self, basehead: str, segment_name: str) -> PagingList[DataDiff]:
return PagingList(
lambda offset, limit: self._generate_data_diffs(basehead, segment_name, offset, limit),
128,
10,
)

def _list_segment_instances(self) -> PagingList[Segment]:
Expand Down Expand Up @@ -543,7 +543,7 @@ def get_diff(self, *, head: Optional[Union[str, int]] = None) -> DatasetDiff:
basehead = self._get_basehead(None, head)

segment_diffs = PagingList(
lambda offset, limit: self._generate_segment_diffs(basehead, offset, limit), 128
lambda offset, limit: self._generate_segment_diffs(basehead, offset, limit), 10
)

dataset_diff = DatasetDiff(self.name, segment_diffs)
Expand Down

0 comments on commit 19322db

Please sign in to comment.