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

Chore: fix python type hints #4

Merged
merged 4 commits into from
Jul 31, 2023
Merged

Conversation

mackenzie-grimes-noaa
Copy link
Contributor

@mackenzie-grimes-noaa mackenzie-grimes-noaa commented Jul 31, 2023

Correct some python type hint decorators which didn't match the actual runtime variables returned from functions in aws_utils.py and utils.py.

  • For example, functions that return a Sequence, or sometimes None on error, were annotated to always return a Sequence.
  • Or a function parameter which default to None was typed as non-null, so linters would complain if you omitted the parameter but the code would execute without issue.

Copy link
Contributor

@Geary-Layne Geary-Layne left a comment

Choose a reason for hiding this comment

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

Good cleanup. I didn't know about Optional or Generator typing.

Copy link
Contributor

Choose a reason for hiding this comment

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

This does not regard any code changes made as part of this pull request: I wonder if we have a team standard for when to raise an exception vs (maybe in addition too) logging.

@mackenzie-grimes-noaa
Copy link
Contributor Author

mackenzie-grimes-noaa commented Jul 31, 2023

Good cleanup. I didn't know about Optional or Generator typing.

I do like Optional, if only because it's a little less to type than Union[<my type>, None]. Code linters should interpret them the same. I think it's the closest Python has to what other languages call "Nullable"

@mackenzie-grimes-noaa mackenzie-grimes-noaa merged commit 1c09d65 into main Jul 31, 2023
4 checks passed
@mackenzie-grimes-noaa mackenzie-grimes-noaa deleted the chore/type-hint-fixes branch July 31, 2023 21:56
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