sc2: Many typing and style fixes; fixed some broken logic functions #370
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is this fixing or adding?
Mypy fixes, and fixing some broken (always true) logic functions in locations.py highlighted by mypy.
This gets the typing issue count down by several hundred. The biggest improvement came from changing
get_option_value()
's return type fromUnion[int, FrozenSet]
toint
(which isn't always accurate, but more accurate than the old one). Added a comment to it as well to discourage using it, which will hopefully get people to the syntax that actually gives the correct type.Next biggest improvement was to rules.py, accurately annotating the functions/methods that are null-safe on their world parameter, and setting the
player
default value to -1 instead of None so the logic functions don't all scream.I stayed away from pool_filter.py and those parts in init.py that I already fixed up in #369. I also tried to stay away from the mission_order subdirectory as I don't fully understand that code, I assume Salz is still touching it up occasionally, and it generally had a dozen issues per file. Outside of those places, the issue count in the sc2 world should be in the single-digits.
How was this tested?
Ran all unit tests. Ran mypy many times.
If this makes graphical changes, please attach screenshots.
(800+ of these are in alttp/core; used to be 1400~1500)