Repository navigation
removing None's when it shouldn't be allowed - #1862
Conversation
Sevans711
left a comment
There was a problem hiding this comment.
Checked by-eye: all removed None hints seem correct to remove. Also did a variety of spot-checks for docstrings for any lingering messages in these cases about None being a possible input type, but didn't find any incorrect docstrings.
Also checked by-eye: all 76 remaining None hints (from searching the codebase for | None) and 5 remaining Optional hints (from searching the codebase for Optional[) look correct to keep.
Even though there isn't any CI test which tests for correctness of these changes (see also #1763), it isn't too risky to merge, because it only touches type hints.
Sidenote: this supersedes #1612, which should probably be closed with clarifying comment, after this merges.
Happy to approve this one as-is!
Closes #1593
Overview
Removes several mentioned and other found instances of "None" being allowed as inputs when they shouldn't be, often resulting in errors that have not been accounted for.
Some we need to keep, as None is a valid input in some cases, like when plotting:
Optional[X]has also been removed in a few instances, as it is effectively the same asX | Noneand causes the same problems. Some were left untoutched as they have valid usage as they currently are (ieprojection: Optional[ccrs.Projection] = None). it looks like these were intended to be removed in #1418 but some may have been missed.Expected Usage
N/A
PR Checklist
General
Testing & Benchmarking
Documentation and Examples
docs/api.rst; internal (private) function names start with an underscore (_)AI Disclosure
AI Usage:
Claude Code