Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): fix the typo of "params" and adjust the limit in diff api #935

Merged
merged 1 commit into from
Aug 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
rexzheng324-c marked this conversation as resolved.
Show resolved Hide resolved
) -> 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