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

refactor: improve typing and delete mutable default arguments #421

Conversation

framunoz
Copy link
Contributor

@framunoz framunoz commented Jan 16, 2025

With respect the PR #409

Some methods uses mutable parameters, for example

We realized that wih Rodrigo some time ago, I would suggest to do it in a follow-up PR

I mentioned that are many mutable parameters. This is the follow-up PR to fix it.

The changes are:

  • Improve typing: The list are more specific and the paths can be a Path instance.
  • Drop mutable default arguments: Replace empty list with Nones
  • Convert a method in static if the method doesn't use anything.

@framunoz
Copy link
Contributor Author

I realise that in the module ee_image in the function plot_hist appears the following lines:

eeBands = ee.List(bands) if len(bands) == 0 else self._obj.bandNames()
eeLabels = ee.List(labels).flatten() if len(labels) == 0 else eeBands

That is, if the bands list is empty, it creates a list of bands. If the bands list is not empty, it uses all bands. Is this correct? If so, I think there is a bug in this function.

geetools/ee_authenticate.py Outdated Show resolved Hide resolved
geetools/ee_feature_collection.py Show resolved Hide resolved
geetools/ee_image.py Outdated Show resolved Hide resolved
geetools/utils.py Outdated Show resolved Hide resolved
@framunoz framunoz requested a review from 12rambau January 20, 2025 22:50
geetools/ee_image.py Show resolved Hide resolved
@12rambau 12rambau changed the base branch from main to delete-mutable-builtins-in-signature January 21, 2025 20:00
@12rambau 12rambau merged commit 1aa998c into gee-community:delete-mutable-builtins-in-signature Jan 21, 2025
3 of 9 checks passed
@framunoz framunoz deleted the refactor/delete-mutable-builtins-in-signature branch January 21, 2025 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants