Refactor some rarely-used utils functions #382
Merged
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.
Also delete some code that's been commented out for ages.
A continuation of #381, I moved two functions from utils to surface_utils, because they were only used there anyway. Although it might be questionable if we need some of those at all...
Rant
I don't like all these
return None
at all. I think a function should always return the same type if at all possible. Thereturn None
are not new though, they're just a refactored ("return early") approach of what was already there. I think thosereturn None
cases should either raise an exception that's caught upstream, or not exist at all. But I kept them in for now, as something somewhere might depend on thatNone
being returned (I hope not). Once we finally get around to doing some static type checking, we should find all thesereturn None
things thrown in our faces anyway...