Skip to content

Commit 6687038

Browse files
committed
Improves responses dict access types
1 parent 16d53c7 commit 6687038

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

algoliasearch/responses.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ def wait(self):
2626

2727
pass # pragma: no cover
2828

29-
@abc.abstractmethod
30-
def __getitem__(self, key):
31-
# type:(Union[int, str]) -> Union[int, str, dict]
32-
33-
pass # pragma: no cover
34-
3529

3630
class IndexingResponse(Response):
3731

@@ -55,7 +49,7 @@ def wait(self):
5549
return self
5650

5751
def __getitem__(self, key):
58-
# type:(Union[int, str]) -> Union[int, str, dict]
52+
# type:(int) -> dict
5953

6054
return self.raw_responses[key]
6155

@@ -68,9 +62,6 @@ def __init__(self, responses=None):
6862
self.responses = [] if responses is None else responses
6963
self._waitable = list(self.responses)
7064

71-
def __repr__(self):
72-
return self.responses
73-
7465
def push(self, response):
7566
# type: (Response) -> None
7667

@@ -90,7 +81,7 @@ def wait(self):
9081
return self
9182

9283
def __getitem__(self, key):
93-
# type:(Union[int, str]) -> Union[int, str, dict]
84+
# type:(int) -> Response
9485

9586
return self.responses[key]
9687

@@ -118,7 +109,7 @@ def wait(self):
118109
return self
119110

120111
def __getitem__(self, key):
121-
# type:(Union[int, str]) -> Union[int, str, dict]
112+
# type:(str) -> Union[int, str, dict, list]
122113

123114
return self.raw_response[key]
124115

@@ -162,7 +153,7 @@ def _have_changed(self, api_key):
162153
valid_key)) for valid_key in valid_keys])
163154

164155
def __getitem__(self, key):
165-
# type:(Union[int, str]) -> Union[int, str, dict]
156+
# type:(str) -> Union[int, str, dict, list]
166157

167158
return self.raw_response[key]
168159

@@ -189,7 +180,7 @@ def wait(self):
189180
return self
190181

191182
def __getitem__(self, key):
192-
# type:(Union[int, str]) -> Union[int, str, dict]
183+
# type:(str) -> Union[int, str, dict, list]
193184

194185
return self.raw_response[key]
195186

@@ -218,7 +209,7 @@ def wait(self):
218209
return self
219210

220211
def __getitem__(self, key):
221-
# type:(Union[int, str]) -> Union[int, str, dict]
212+
# type:(str) -> Union[int, str, dict, list]
222213

223214
return self.raw_response[key]
224215

@@ -243,6 +234,6 @@ def wait(self):
243234
return self
244235

245236
def __getitem__(self, key):
246-
# type:(Union[int, str]) -> Union[int, str, dict]
237+
# type:(str) -> Union[int, str, dict, list]
247238

248239
return self.raw_response[key]

0 commit comments

Comments
 (0)