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.
This will fix lots of typing issues that can be detected using the following mypy config. These commits don't just include simple type annotation changes, but also rearrange and fix a couple of minor things, which is why I didn't create just a single big commit for this.
https://mypy.readthedocs.io/en/stable/index.html
As you can see, there's no commit in this PR for adding mypy to the CI, because it's been a rather unstable experience. mypy has crashed a lot while fixing all these issues and its reports were often flaky and inconsistent, despite clearing and/or disabling its cache. In my test repo, it crashed during its CI run, showing that it's not suitable at the moment.
There's also a ton of stuff which doesn't make sense to me. For example, it complains that the custom
log.tracemethod doesn't exist (as the base logging class is retrieved dynamically during runtime vialogging.setLoggerClass()/logging.getLoggerClass()), which makes sense for a static type checker, but it only complains about that in the ustream plugin for some reason and nowhere else.Then there's also the issue with some custom HLSStream and SegmentedStream implementations, which currently requires having a ton of ignore pragmas. Named tuples for example can't be subclassed, and dataclasses (or the attrs library) would be required as a replacement for that, which requires a bigger rework. I want to do this eventually though.
And py37 is unfortunately a bit limited in terms of the typing module, so certain things can't be used without a stub-module, which I don't want to add.