Bump mypy for py3.8 support

mypy depends on typed-ast which relatively recently added python 3.8
support. Unfortunately the mypy we were using requires an older
typed-ast and fails under python 3.8. Fix this by bumping mypy up to a
level where minimal code changes are necessary.

The code changes we made ignore type conflicts due to redefinition on
conditional imports. Comments include link back to a bug describing this
issue and workaround in mypy.

Change-Id: Iec69a27b16a1e09eb6bfbcf8d68deb1ae68d42a3
This commit is contained in:
Clark Boylan 2020-04-27 17:43:50 -07:00
parent 9b300bc8df
commit 92dba202ed
2 changed files with 4 additions and 3 deletions

View File

@ -53,7 +53,7 @@ install_command = pip install {opts} {packages}
# type checking on the world - just on ourselves.
deps =
flake8
mypy<0.650
mypy<0.740
openapi-spec-validator
commands =
flake8 {posargs}

View File

@ -14,14 +14,15 @@ from yaml import YAMLObject, YAMLError # noqa: F401
try:
# Explicit type ignore to deal with provisional import failure
# Details at https://github.com/python/mypy/issues/1153
from yaml import cyaml # type: ignore
import _yaml
SafeLoader = cyaml.CSafeLoader
SafeDumper = cyaml.CSafeDumper
Mark = _yaml.Mark
except ImportError:
SafeLoader = yaml.SafeLoader
SafeDumper = yaml.SafeDumper
SafeLoader = yaml.SafeLoader # type: ignore
SafeDumper = yaml.SafeDumper # type: ignore
Mark = yaml.Mark