Coding 2022-12-25
Dealing with these isinstance calls is hairier than I wanted it to be. I took care of some of them earlier today, and had to reconsider my approach for others later. I haven't tried to fix those yet, maybe tomorrow, maybe next week.
In any case, I did replace some imprecise types with mildly more specific ones, and pulled the relevant logic out of the function and stuck it at the top level. That should open up some similar refactorings later, to help flatten out some methods even more.
At the end of the day, it is the end of the day, and I didn't take enough time to write this post up beforehand, so I'm going to cut this off abruptly now.
Good night.