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:
parent
9b300bc8df
commit
92dba202ed
2
tox.ini
2
tox.ini
|
@ -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}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue