diff options
Diffstat (limited to 'jsonschema')
-rw-r--r-- | jsonschema/protocols.py | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/jsonschema/protocols.py b/jsonschema/protocols.py index 340b711..f324ea1 100644 --- a/jsonschema/protocols.py +++ b/jsonschema/protocols.py @@ -8,20 +8,14 @@ typing.Protocol classes for jsonschema interfaces. from __future__ import annotations from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, ClassVar, Iterable -import sys - -# doing these imports with `try ... except ImportError` doesn't pass mypy -# checking because mypy sees `typing._SpecialForm` and -# `typing_extensions._SpecialForm` as incompatible -# -# see: -# https://mypy.readthedocs.io/en/stable/runtime_troubles.html#using-new-additions-to-the-typing-module -# https://github.com/python/mypy/issues/4427 -if sys.version_info >= (3, 8): - from typing import Protocol, runtime_checkable -else: - from typing_extensions import Protocol, runtime_checkable +from typing import ( + TYPE_CHECKING, + Any, + ClassVar, + Iterable, + Protocol, + runtime_checkable, +) # in order for Sphinx to resolve references accurately from type annotations, # it needs to see names like `jsonschema.TypeChecker` |