-
Notifications
You must be signed in to change notification settings - Fork 114
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
Add limit
, offset
and include_deleted
to show_folder
#494
base: main
Are you sure you want to change the base?
Conversation
4df08d9
to
99cd859
Compare
36073c5
to
790a7f7
Compare
790a7f7
to
5b889cf
Compare
b611bde
to
7fc18e4
Compare
limit
, offset
and include_deleted
to show_folder
7fc18e4
to
c1700ad
Compare
c1700ad
to
c49b94a
Compare
Co-authored-by: Nicola Soranzo <[email protected]>
Co-authored-by: Nicola Soranzo <[email protected]>
Co-authored-by: Nicola Soranzo <[email protected]>
…blend into folder-update
Co-authored-by: Nicola Soranzo <[email protected]>
Co-authored-by: Nicola Soranzo <[email protected]>
|
||
folder_info = self.gi.folders.show_folder(self.folder["id"], contents=True) | ||
assert len(folder_info["folder_contents"]) == 0 | ||
assert folder_info["metadata"]["total_rows"] == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
total_rows
in the metadata (which is only returned if contents=True
) seems correct .. but slightly annoying that the key is different.
Wondering if we should untangle this a bit?
Using |
237c77e
to
02cd70d
Compare
02cd70d
to
30c4c91
Compare
Maybe like this: 30c4c91 simplifies the code I'm working on quite a bit: |
# if called without contents=True an item_count is reported .. lets also check this | ||
folder_info = self.gi.folders.show_folder(self.folder["id"], include_deleted=True) | ||
assert folder_info["item_count"] == 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No point in testing this, since include_deleted=True
is ignored you are checking the same as lines 102-104.
# if called without contents=True an item_count is reported .. lets also check this | |
folder_info = self.gi.folders.show_folder(self.folder["id"], include_deleted=True) | |
assert folder_info["item_count"] == 2 |
:rtype: dict | ||
:return: A generator for the folder contents | ||
""" | ||
total_rows: Optional[int] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
total_rows: Optional[int] = None | |
total_rows = sys.maxsize |
And add import sys
at the top.
"include_deleted": include_deleted, | ||
} | ||
|
||
while total_rows is None or params["offset"] <= total_rows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while total_rows is None or params["offset"] <= total_rows: | |
while params["offset"] <= total_rows: |
def contents( | ||
self, | ||
folder_id: str, | ||
limit: int = 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd call it chunk_size
in this context, as used in the rest of the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can rename this, but actually it seems that we already have a mix of limit and chunk_size (slightly more limit .. it seems).
All BioBlend low-level wrapper methods for containers (histories, libraries, folders) currently work this way, maybe it'd be useful to improve the method annotation with overloads, like https://github.com/galaxyproject/bioblend/blob/main/bioblend/galaxy/histories/__init__.py#L307-L335
Usually this (slightly) higher-level manipulation have been implemented in BioBlend.objects , but this looks fine to me. |
Co-authored-by: Nicola Soranzo <[email protected]>
dfef8a7
to
4a46da3
Compare
No description provided.