Commit 47a52f6
authored
Improve first iteration logic (#1101)
Improving the first iteration logic in `PageIterator` and `ResultIterator`.
Both iterators had a `_first_iteration` state attribute that could be replaced with better logic:
- In `PageIterator`, it can be replaced with `_is_last_page` which
- is exception-safe (only mutate after we do I/O), and
- (IMO) more directly relates to the state we're handling
- In `ResultsIterator`, we can do without `_first_iteration` (but we should initialize `_index` and `_count`)
Inspired by #1059.1 parent 4421acb commit 47a52f6
2 files changed
+34
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | 93 | | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
110 | 108 | | |
111 | 109 | | |
112 | 110 | | |
113 | 111 | | |
114 | 112 | | |
115 | 113 | | |
116 | 114 | | |
| 115 | + | |
117 | 116 | | |
118 | 117 | | |
119 | 118 | | |
| |||
170 | 169 | | |
171 | 170 | | |
172 | 171 | | |
173 | | - | |
174 | 172 | | |
175 | 173 | | |
176 | 174 | | |
| 175 | + | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | 192 | | |
197 | 193 | | |
198 | 194 | | |
| |||
209 | 205 | | |
210 | 206 | | |
211 | 207 | | |
212 | | - | |
| 208 | + | |
213 | 209 | | |
214 | 210 | | |
215 | 211 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1347 | 1347 | | |
1348 | 1348 | | |
1349 | 1349 | | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
1350 | 1377 | | |
1351 | 1378 | | |
1352 | 1379 | | |
| |||
0 commit comments