From 6e761535580530ff1ac3cbba7e07f1eeb9bcef49 Mon Sep 17 00:00:00 2001 From: "dmitry.dygalo" Date: Fri, 24 Jan 2020 02:13:05 +0100 Subject: [PATCH] refactor: Use a custom class instead of `object` for sentinel instance It makes typing stricter, since types don't depend on a very generic `object` type --- src/schemathesis/types.py | 7 ++++++- src/schemathesis/utils.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/schemathesis/types.py b/src/schemathesis/types.py index cd541ab17d..2edaece844 100644 --- a/src/schemathesis/types.py +++ b/src/schemathesis/types.py @@ -13,7 +13,12 @@ Cookies = Dict[str, Any] # pragma: no mutate FormData = Dict[str, Any] # pragma: no mutate + +class NotSet: + pass + + # A filter for endpoint / method -Filter = Union[str, List[str], Tuple[str], Set[str], object] # pragma: no mutate +Filter = Union[str, List[str], Tuple[str], Set[str], NotSet] # pragma: no mutate Hook = Callable[[SearchStrategy], SearchStrategy] diff --git a/src/schemathesis/utils.py b/src/schemathesis/utils.py index 3a65dec614..448cd02ca3 100644 --- a/src/schemathesis/utils.py +++ b/src/schemathesis/utils.py @@ -11,9 +11,9 @@ from werkzeug.wrappers import Response as BaseResponse from werkzeug.wrappers.json import JSONMixin -from .types import Filter +from .types import Filter, NotSet -NOT_SET = object() +NOT_SET = NotSet() def deprecated(func: Callable, message: str) -> Callable: