-
Notifications
You must be signed in to change notification settings - Fork 41
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
rename id in connection.load_collection #245
base: master
Are you sure you want to change the base?
Conversation
@@ -833,7 +833,7 @@ def load_collection( | |||
""" | |||
Load a DataCube by collection id. | |||
|
|||
:param collection_id: image collection identifier |
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.
Should this be deprecated instead of being removed?
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.
Would I just put @deprecated("Use 'id' instead")
above the :param collection_id
line?
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.
Sounds good to me, but @soxofaan should have the final vote.
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 don't think we can make a breaking change like this.
Existing code that uses keyword argument load_collection(collection_id="S2")
will break.
There should be a fallback mechanism:
- give
id
default value None - add a
**kwargs
and check ifcollection_id
is set (and raise deprecation warning if that is the case)
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.
Yes, that's what I meant to say :-D
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.
def load_collection(
self,
id: str = None,
[...]
if "collection_id" in kwargs:
id = kwargs["collection_id"]
warnings.warn("The use of `collection_id` is deprecated, use `id` instead.", DeprecationWarning)
like so?
@@ -842,13 +842,13 @@ def load_collection( | |||
""" | |||
if self._api_version.at_least("1.0.0"): | |||
return DataCube.load_collection( | |||
collection_id=collection_id, connection=self, | |||
collection_id=id, connection=self, |
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 think the load_collection
methods of DataCube and ImageCollectionClient should also be addressed
but here it's fine to do it in a backwards incompatible way because these are practically "internal" methods nobody should be using
also to do:
|
What do you mean by this? |
test that both |
Alright, did that. Didn't add tests for |
Should the parameter also be changed in
datacube.load_collection()
andimagecollectionclient.load_collection()
?