Fixes for mypy 0.901
mypy just updated and we need to update to match it. 1. They no longer ship third party stubs so for three packages (dateutil, pytz & pkg_resources) we need to install their respective types-* package for the mypy tests. These are added to tox.ini::mypy as well as requirements-dev.txt 2. Improvements to type checking found a error; ColorType does not include List and so a check for `type(color) == list` is adjusted accordingly.master
parent
6a206138f4
commit
d56117ba84
|
@ -521,8 +521,8 @@ class Drawer:
|
|||
def new_ctx(self):
|
||||
return pangocffi.patch_cairo_context(cairocffi.Context(self.surface))
|
||||
|
||||
def set_source_rgb(self, colour: ColorType):
|
||||
if type(colour) == list:
|
||||
def set_source_rgb(self, colour: Union[ColorType, List[ColorType]]):
|
||||
if isinstance(colour, list):
|
||||
if len(colour) == 0:
|
||||
# defaults to black
|
||||
self.ctx.set_source_rgba(*utils.rgb("#000000"))
|
||||
|
|
|
@ -2,6 +2,9 @@ flake8
|
|||
flake8-isort
|
||||
flake8-tidy-imports
|
||||
mypy
|
||||
types-python-dateutil
|
||||
types-pytz
|
||||
types-pkg_resources
|
||||
pep8-naming
|
||||
psutil
|
||||
pytest-cov
|
||||
|
|
Loading…
Reference in New Issue