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

Object.get_or_create_by_full_path() #331

Merged
merged 8 commits into from Apr 24, 2020
Merged

Object.get_or_create_by_full_path() #331

merged 8 commits into from Apr 24, 2020

Conversation

jsh2134
Copy link
Contributor

@jsh2134 jsh2134 commented Apr 24, 2020

Allows creating nested paths on the fly, which currently requires way too many lines of code. Takes the existing Dataset.get_or_create_by_full_path() and moves and upgrades it.

Also closes #326
Also closes #287

@jsh2134 jsh2134 marked this pull request as ready for review April 24, 2020 17:44
@jsh2134 jsh2134 requested a review from davecap April 24, 2020 17:44
solvebio/resource/dataset.py Outdated Show resolved Hide resolved
except KeyError as err:
if name in valid_dataset_attrs and self.is_dataset:
return getattr(
Dataset(self.dataset_id, client=self._client), name)
Copy link
Member

Choose a reason for hiding this comment

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

why not getattr(self.dataset, name)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we don't need to do the lookup to get the Dataset object in most cases. Wanted to avoid making the GET request if possible, which is why I used the instance.refresh() logic within those methods that needed them

Copy link
Member

Choose a reason for hiding this comment

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

but then why not just not do the lookup in def dataset?

solvebio/resource/object.py Outdated Show resolved Hide resolved
@jsh2134 jsh2134 merged commit aacd379 into master Apr 24, 2020
@jsh2134 jsh2134 deleted the object-get-or-create branch April 24, 2020 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants