Some type annotations and some export key refactoring by exarkun · Pull Request #477 · gridsync/gridsync
and others added 28 commits
May 5, 2022 15:31I don't know what the deal with QThread is but it's more work to use than Twisted's thread API and when you make a mistake, it SIGABRTs your whole process instead of giving you an exception, so let's not use it if we don't have to.
Without this, mypy (and/or pyqt5-stubs?) thinks ZKAPBarChartView's inherited `chart()` method will always/only return a plain `QChart` (and will throw an "attr-defined" error -- "'QChart' has no attribute 'update_chart'"). Using a custom getter here avoids this confusion: `ZKAPBarChartView.get_chart` will always/only return a `ZKAPBarChart`.
As with the previous commit, using this custom/type-annotated getter informs mypy that we are always/only expecting `View` to use a `Model` (from gridsync/gui/model.py) for its model and not some other, broader type that's missing the methods/attributes we want to type-check.
exarkun
deleted the
some-more-type-annotations.2
branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters