Commit 6eee494
feat(api)!: ListMixin.list typing overload
BREAKING CHANGE: The `http_list` method will no longer
ignore the `iterator` argument if the `page` argument is not
None. The `ListMixin.list()` will now return either list or
iterator based on the `iterator` argument. This will make
certain type narrowing checks redundant.
Overload `ListMixin.list` method typing to return either
`RESTObjectList` or `list` based on the `iterator` argument.
By default then `iterator` is False return a list otherwise
return an iterator.
Provide 3 overloads:
1. `iterator: Literal[False]` - this is the default and returns a list.
2. `iterator: Literal[True]` - return an iterator.
3. `iterator: bool` - return either list or iterator. It is useful when
the list function is being extended by another function that can
also take either True or False for the `iterator` argument.
Make `page` argument to `http_list` not override the `iterator`
to make the function signatures more straight forward. This
also makes it easier to unpack `**kwargs` as only `iterator`
argument will control if a list or iterator is returned so the
`**kwargs` can no longer have a hidden page argument.1 parent beb2f24 commit 6eee494Copy full SHA for 6eee494
File tree
Expand file treeCollapse file tree
8 files changed
+134
-35
lines changedOpen diff view settings
Filter options
- gitlab
- v4
- objects
- tests
- functional/api
- unit
Expand file treeCollapse file tree
8 files changed
+134
-35
lines changedOpen diff view settings
Collapse file
+9-11Lines changed: 9 additions & 11 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
881 | 881 | |
882 | 882 | |
883 | 883 | |
884 | | - |
885 | | - |
886 | | - |
887 | | - |
888 | | - |
889 | | - |
890 | | - |
891 | | - |
892 | | - |
893 | | - |
| 884 | + |
| 885 | + |
| 886 | + |
| 887 | + |
| 888 | + |
| 889 | + |
| 890 | + |
| 891 | + |
| 892 | + |
894 | 893 | |
895 | | - |
896 | 894 | |
897 | 895 | |
898 | 896 | |
|
Collapse file
+17-2Lines changed: 17 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
161 | 161 | |
162 | 162 | |
163 | 163 | |
| 164 | + |
| 165 | + |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | + |
| 172 | + |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | + |
| 178 | + |
164 | 179 | |
165 | 180 | |
166 | | - |
| 181 | + |
167 | 182 | |
168 | 183 | |
169 | 184 | |
| ||
203 | 218 | |
204 | 219 | |
205 | 220 | |
206 | | - |
| 221 | + |
207 | 222 | |
208 | 223 | |
209 | 224 | |
|
Collapse file
+4-7Lines changed: 4 additions & 7 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
133 | 133 | |
134 | 134 | |
135 | 135 | |
136 | | - |
137 | | - |
138 | | - |
139 | | - |
140 | | - |
141 | | - |
| 136 | + |
142 | 137 | |
143 | 138 | |
144 | 139 | |
| ||
150 | 145 | |
151 | 146 | |
152 | 147 | |
153 | | - |
| 148 | + |
| 149 | + |
| 150 | + |
154 | 151 | |
155 | 152 | |
156 | 153 | |
|
Collapse file
+20-3Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
1 | 1 | |
2 | 2 | |
3 | | - |
| 3 | + |
4 | 4 | |
5 | 5 | |
6 | 6 | |
| ||
17 | 17 | |
18 | 18 | |
19 | 19 | |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
20 | 35 | |
21 | | - |
| 36 | + |
| 37 | + |
| 38 | + |
22 | 39 | |
23 | 40 | |
24 | 41 | |
| ||
45 | 62 | |
46 | 63 | |
47 | 64 | |
48 | | - |
| 65 | + |
49 | 66 | |
50 | 67 | |
51 | 68 | |
Collapse file
gitlab/v4/objects/snippets.py
Copy file name to clipboardExpand all lines: gitlab/v4/objects/snippets.py+61-6Lines changed: 61 additions & 6 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
108 | 108 | |
109 | 109 | |
110 | 110 | |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
111 | 126 | |
112 | | - |
| 127 | + |
| 128 | + |
| 129 | + |
113 | 130 | |
114 | 131 | |
115 | 132 | |
| ||
126 | 143 | |
127 | 144 | |
128 | 145 | |
129 | | - |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | + |
| 159 | + |
| 160 | + |
| 161 | + |
130 | 162 | |
131 | 163 | |
132 | | - |
| 164 | + |
| 165 | + |
| 166 | + |
133 | 167 | |
134 | 168 | |
135 | 169 | |
| ||
146 | 180 | |
147 | 181 | |
148 | 182 | |
149 | | - |
| 183 | + |
| 184 | + |
| 185 | + |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | + |
| 190 | + |
| 191 | + |
| 192 | + |
| 193 | + |
| 194 | + |
| 195 | + |
| 196 | + |
| 197 | + |
| 198 | + |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | + |
150 | 203 | |
151 | | - |
| 204 | + |
| 205 | + |
| 206 | + |
152 | 207 | |
153 | 208 | |
154 | 209 | |
| ||
172 | 227 | |
173 | 228 | |
174 | 229 | |
175 | | - |
| 230 | + |
176 | 231 | |
177 | 232 | |
178 | 233 | |
|
Collapse file
+20-3Lines changed: 20 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
6 | 6 | |
7 | 7 | |
8 | 8 | |
9 | | - |
| 9 | + |
10 | 10 | |
11 | 11 | |
12 | 12 | |
| ||
623 | 623 | |
624 | 624 | |
625 | 625 | |
626 | | - |
| 626 | + |
| 627 | + |
| 628 | + |
| 629 | + |
| 630 | + |
| 631 | + |
| 632 | + |
| 633 | + |
| 634 | + |
| 635 | + |
| 636 | + |
| 637 | + |
| 638 | + |
| 639 | + |
| 640 | + |
| 641 | + |
| 642 | + |
| 643 | + |
627 | 644 | |
628 | 645 | |
629 | 646 | |
| ||
645 | 662 | |
646 | 663 | |
647 | 664 | |
648 | | - |
| 665 | + |
649 | 666 | |
650 | 667 | |
651 | 668 | |
|
Collapse file
tests/functional/api/test_merge_requests.py
Copy file name to clipboardExpand all lines: tests/functional/api/test_merge_requests.py+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
177 | 177 | |
178 | 178 | |
179 | 179 | |
180 | | - |
| 180 | + |
181 | 181 | |
182 | 182 | |
183 | 183 | |
|
Collapse file
tests/unit/test_gitlab_http_methods.py
Copy file name to clipboardExpand all lines: tests/unit/test_gitlab_http_methods.py+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
567 | 567 | |
568 | 568 | |
569 | 569 | |
570 | | - |
571 | | - |
| 570 | + |
| 571 | + |
572 | 572 | |
573 | 573 | |
574 | 574 | |
|
0 commit comments