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

Client.write_data default value {} should be changed #1104

Closed
briantist opened this issue Nov 5, 2023 · 0 comments · Fixed by #1120
Closed

Client.write_data default value {} should be changed #1104

briantist opened this issue Nov 5, 2023 · 0 comments · Fixed by #1120
Assignees
Labels
bug client related to the hvac Client patch Used as part of release-drafter's version-resolver configuration
Milestone

Comments

@briantist
Copy link
Contributor

briantist commented Nov 5, 2023

data: t.Dict[str, t.Any] = {},

https://pylint.pycqa.org/en/latest/user_guide/messages/warning/dangerous-default-value.html

It seems this default was a bad idea.

As far as I know, all the code this value will go through will not mutate the value, but we should fix this before that situation changes.

I think we'll be able to default it to None and everything will still work correctly even if we pass it to post that way; worst case it doesn't and we default to {} inside the function if it's None.

Either way this change won't be breaking and will prevent future pain, breakage, and surprise.


I found this in a downstream project that uses pylint. It raises the question of whether we should maybe be using pylint, or perhaps #1059 would have caught it as well?

@briantist briantist added bug patch Used as part of release-drafter's version-resolver configuration client related to the hvac Client labels Nov 5, 2023
@briantist briantist added this to the 2.1.0 milestone Nov 5, 2023
@briantist briantist self-assigned this Nov 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug client related to the hvac Client patch Used as part of release-drafter's version-resolver configuration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant