-
Notifications
You must be signed in to change notification settings - Fork 10
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
Scoped object search #373
base: master
Are you sure you want to change the base?
Scoped object search #373
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -406,20 +406,39 @@ def _object_list_helper(self, **params): | |
items = self.all(client=self._client, **params) | ||
return items | ||
|
||
def files(self, **params): | ||
def files(self, query='', **params): | ||
if query: | ||
params['query'] = query | ||
params.pop('object_type', None) | ||
return self._object_list_helper(object_type='file', **params) | ||
|
||
def folders(self, **params): | ||
def folders(self, query='', **params): | ||
if query: | ||
params['query'] = query | ||
params.pop('object_type', None) | ||
return self._object_list_helper(object_type='folder', **params) | ||
|
||
def datasets(self, **params): | ||
def datasets(self, query='', **params): | ||
if query: | ||
params['query'] = query | ||
params.pop('object_type', None) | ||
return self._object_list_helper(object_type='dataset', **params) | ||
|
||
def objects(self, **params): | ||
def objects(self, query='', **params): | ||
if query: | ||
params['query'] = query | ||
return self._object_list_helper(**params) | ||
|
||
def ls(self, **params): | ||
return self.objects(**params) | ||
def ls(self, query='', **params): | ||
query = query or params.pop('query', '') | ||
return self.objects(query=query, **params) | ||
|
||
def search(self, query='', **params): | ||
query = query or params.pop('query', '') | ||
# TODO | ||
params['ancestor_id'] = self.id | ||
params['limit'] = 1000 | ||
return super(Object, self).search(query, **params) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe I left this TODO in here in order to determine if there should be a recursive option. Should the user be able to get anything in this folder, or just depth=0 objects. and/or This PR needs tests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets keep it ancestor_id so that it is recursive. Users can pass depth=0 if they want, and we will document this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Object.search(), super not necessary because search is a classmethod |
||
|
||
def __getattr__(self, name): | ||
"""Shortcut to access attributes of the underlying Dataset resource""" | ||
|
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.
This is not necessary