From 26bb973e26fe04e39e33a42af7d054e3a607a094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlastimil=20Z=C3=ADma?= Date: Wed, 12 Oct 2022 16:48:29 +0200 Subject: [PATCH] Fix annotations of CallList (#593) --- CHANGES | 5 +++++ responses/__init__.py | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/CHANGES b/CHANGES index 3aa996be..23ff994e 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +0.23.0 +------ + +* Fix type annotations of `CallList`. + 0.22.0 ------ diff --git a/responses/__init__.py b/responses/__init__.py index 2a2c083b..aab595f1 100644 --- a/responses/__init__.py +++ b/responses/__init__.py @@ -230,6 +230,14 @@ def __iter__(self) -> Iterator[Call]: def __len__(self) -> int: return len(self._calls) + @overload + def __getitem__(self, idx: int) -> Call: + ... + + @overload + def __getitem__(self, idx: slice) -> List[Call]: + ... + def __getitem__(self, idx: Union[int, slice]) -> Union[Call, List[Call]]: return self._calls[idx]