Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion labelbox/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class _CursorPagination(_Pagination):
def __init__(self, cursor_path: List[str], *args, **kwargs):
super().__init__(*args, **kwargs)
self.cursor_path = cursor_path
self.next_cursor: Optional[Any] = None
self.next_cursor: Optional[Any] = kwargs.get('params', {}).get('from')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes the code a bit obscure. To enhance readability and maintainability, what do you think about explicitly adding params to the arguments of the constructor?

Copy link
Contributor Author

@vbrodsky vbrodsky Aug 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is how I had it..
def __init__(self, cursor_path: List[str], params={}, *args, **kwargs):
but in the parent init mypy had issues with it... ok let me look at it again

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had it like you suggested, but had issues similar to https://stackoverflow.com/questions/21764770/typeerror-got-multiple-values-for-argument with mypy.. so I would prob have to 're-add' it back into kwargs before calling the parent constructor. Let me see


def increment_page(self, results: Dict[str, Any]):
for path in self.cursor_path:
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/test_data_rows.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ def test_data_row_bulk_creation(dataset, rand_gen, image_url):
assert {data_row.row_data for data_row in data_rows} == {image_url}
assert {data_row.global_key for data_row in data_rows} == {None}

data_rows = list(dataset.data_rows(from_cursor=data_rows[0].uid))
assert len(data_rows) == 1

# Test creation using file name
with NamedTemporaryFile() as fp:
data = rand_gen(str).encode()
Expand Down