Type annotate ParameterSet

This commit is contained in:
Ran Benita
2020-05-01 14:40:15 +03:00
parent 43fa1ee8f9
commit ff8b7884e8
4 changed files with 83 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
"""
python version compatibility code
"""
import enum
import functools
import inspect
import os
@@ -33,13 +34,20 @@ else:
if TYPE_CHECKING:
from typing import Type
from typing_extensions import Final
_T = TypeVar("_T")
_S = TypeVar("_S")
NOTSET = object()
# fmt: off
# Singleton type for NOTSET, as described in:
# https://www.python.org/dev/peps/pep-0484/#support-for-singleton-types-in-unions
class NotSetType(enum.Enum):
token = 0
NOTSET = NotSetType.token # type: Final # noqa: E305
# fmt: on
MODULE_NOT_FOUND_ERROR = (
"ModuleNotFoundError" if sys.version_info[:2] >= (3, 6) else "ImportError"