vapoursynth / vsrepo

A simple package repository for VapourSynth
MIT License
113 stars 29 forks source link

Add proper typing to vsrepo with MyPy #177

Closed RivenSkaye closed 2 years ago

RivenSkaye commented 2 years ago

This adds proper typehints and passes typechecking with MyPy. That's a good thing because it means type safety in a dynamically typed language. It also makes it easier to see where errors originate from. Besides that I did some generic cleanup like removing unused imports and preventing re-assigning to a variable immediately after assigning an initial value wherever this could be prevented.

RivenSkaye commented 2 years ago

These changes have been tried and tested btw, they all work on my system

myrsloik commented 2 years ago

They don't change required python versions or anything like that?

RivenSkaye commented 2 years ago

None of that whatsoever. I made all of the typing compatible with pre-3.10 Python versions. The only thing 3.10 adds is alternative syntax for Optionals and Unions, where you can just specify typeA | typeB | None which looks cleaner. MyPy immediately screeched when I did that because I explicitly set it to check for 3.9 compatibility

RivenSkaye commented 2 years ago

Hold up, wait with the merge, I broke something

RivenSkaye commented 2 years ago

All's good again, I unbroke the subprocess.getoutput call and fixed other minor issues