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

attemp to add kwards to rc.ObservationData.from_nc #230

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TC-FF
Copy link
Collaborator

@TC-FF TC-FF commented Nov 7, 2024

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
    • This PR fixes #xyz
  • (If applicable) Documentation has been added / updated (for bug fixes / features).
  • (If applicable) Tests have been added.
  • CHANGELOG.rst has been updated (with summary of main changes).
    • Link to issue (:issue:number) and pull request (:pull:number) has been added.

What kind of change does this PR introduce?

  • ...

Does this PR introduce a breaking change?

Other information:

@@ -78,6 +80,7 @@ def __init__(
data_type,
alt_names_meteo,
meteo_station_properties,
hydro_station_properties={},
Copy link
Collaborator

Choose a reason for hiding this comment

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

This signature creates a mutable default argument, meaning that multiple instances of the RavenPyModel running in the same script could inherit changes to this argument on prior initialisation. See: https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments

Another way to do this would be

Suggested change
hydro_station_properties={},
hydro_station_properties: dict | None = None,

Followed by:

if hydro_station_properties is None:
    hydro_station_properties = {}

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