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.
|
# type checking on the world - just on ourselves.
|
||||||
deps =
|
deps =
|
||||||
flake8
|
flake8
|
||||||
mypy<0.650
|
mypy<0.740
|
||||||
openapi-spec-validator
|
openapi-spec-validator
|
||||||
commands =
|
commands =
|
||||||
flake8 {posargs}
|
flake8 {posargs}
|
||||||
|
|
|
@ -14,14 +14,15 @@ from yaml import YAMLObject, YAMLError # noqa: F401
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Explicit type ignore to deal with provisional import failure
|
# Explicit type ignore to deal with provisional import failure
|
||||||
|
# Details at https://github.com/python/mypy/issues/1153
|
||||||
from yaml import cyaml # type: ignore
|
from yaml import cyaml # type: ignore
|
||||||
import _yaml
|
import _yaml
|
||||||
SafeLoader = cyaml.CSafeLoader
|
SafeLoader = cyaml.CSafeLoader
|
||||||
SafeDumper = cyaml.CSafeDumper
|
SafeDumper = cyaml.CSafeDumper
|
||||||
Mark = _yaml.Mark
|
Mark = _yaml.Mark
|
||||||
except ImportError:
|
except ImportError:
|
||||||
SafeLoader = yaml.SafeLoader
|
SafeLoader = yaml.SafeLoader # type: ignore
|
||||||
SafeDumper = yaml.SafeDumper
|
SafeDumper = yaml.SafeDumper # type: ignore
|
||||||
Mark = yaml.Mark
|
Mark = yaml.Mark
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue