Skip to content

Commit 8affaa7

Browse files
authored
Switch from invariant List to covariant Sequence (#2324)
1 parent c5c4df4 commit 8affaa7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2040
-5836
lines changed

elasticsearch/_async/client/__init__.py

Lines changed: 149 additions & 457 deletions
Large diffs are not rendered by default.

elasticsearch/_async/client/async_search.py

Lines changed: 19 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ async def delete(
3030
*,
3131
id: str,
3232
error_trace: t.Optional[bool] = None,
33-
filter_path: t.Optional[
34-
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
35-
] = None,
33+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3634
human: t.Optional[bool] = None,
3735
pretty: t.Optional[bool] = None,
3836
) -> ObjectApiResponse[t.Any]:
@@ -67,9 +65,7 @@ async def get(
6765
*,
6866
id: str,
6967
error_trace: t.Optional[bool] = None,
70-
filter_path: t.Optional[
71-
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
72-
] = None,
68+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
7369
human: t.Optional[bool] = None,
7470
keep_alive: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
7571
pretty: t.Optional[bool] = None,
@@ -129,9 +125,7 @@ async def status(
129125
*,
130126
id: str,
131127
error_trace: t.Optional[bool] = None,
132-
filter_path: t.Optional[
133-
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
134-
] = None,
128+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
135129
human: t.Optional[bool] = None,
136130
pretty: t.Optional[bool] = None,
137131
) -> ObjectApiResponse[t.Any]:
@@ -172,7 +166,7 @@ async def status(
172166
async def submit(
173167
self,
174168
*,
175-
index: t.Optional[t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]] = None,
169+
index: t.Optional[t.Union[str, t.Sequence[str]]] = None,
176170
aggregations: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
177171
aggs: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
178172
allow_no_indices: t.Optional[bool] = None,
@@ -184,53 +178,30 @@ async def submit(
184178
collapse: t.Optional[t.Mapping[str, t.Any]] = None,
185179
default_operator: t.Optional[t.Union["t.Literal['and', 'or']", str]] = None,
186180
df: t.Optional[str] = None,
187-
docvalue_fields: t.Optional[
188-
t.Union[t.List[t.Mapping[str, t.Any]], t.Tuple[t.Mapping[str, t.Any], ...]]
189-
] = None,
181+
docvalue_fields: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
190182
error_trace: t.Optional[bool] = None,
191183
expand_wildcards: t.Optional[
192184
t.Union[
193-
t.Union["t.Literal['all', 'closed', 'hidden', 'none', 'open']", str],
194-
t.Union[
195-
t.List[
196-
t.Union[
197-
"t.Literal['all', 'closed', 'hidden', 'none', 'open']", str
198-
]
199-
],
200-
t.Tuple[
201-
t.Union[
202-
"t.Literal['all', 'closed', 'hidden', 'none', 'open']", str
203-
],
204-
...,
205-
],
185+
t.Sequence[
186+
t.Union["t.Literal['all', 'closed', 'hidden', 'none', 'open']", str]
206187
],
188+
t.Union["t.Literal['all', 'closed', 'hidden', 'none', 'open']", str],
207189
]
208190
] = None,
209191
explain: t.Optional[bool] = None,
210192
ext: t.Optional[t.Mapping[str, t.Any]] = None,
211-
fields: t.Optional[
212-
t.Union[t.List[t.Mapping[str, t.Any]], t.Tuple[t.Mapping[str, t.Any], ...]]
213-
] = None,
214-
filter_path: t.Optional[
215-
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
216-
] = None,
193+
fields: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
194+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
217195
from_: t.Optional[int] = None,
218196
highlight: t.Optional[t.Mapping[str, t.Any]] = None,
219197
human: t.Optional[bool] = None,
220198
ignore_throttled: t.Optional[bool] = None,
221199
ignore_unavailable: t.Optional[bool] = None,
222-
indices_boost: t.Optional[
223-
t.Union[t.List[t.Mapping[str, float]], t.Tuple[t.Mapping[str, float], ...]]
224-
] = None,
200+
indices_boost: t.Optional[t.Sequence[t.Mapping[str, float]]] = None,
225201
keep_alive: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
226202
keep_on_completion: t.Optional[bool] = None,
227203
knn: t.Optional[
228-
t.Union[
229-
t.Mapping[str, t.Any],
230-
t.Union[
231-
t.List[t.Mapping[str, t.Any]], t.Tuple[t.Mapping[str, t.Any], ...]
232-
],
233-
]
204+
t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]]
234205
] = None,
235206
lenient: t.Optional[bool] = None,
236207
max_concurrent_shard_requests: t.Optional[int] = None,
@@ -246,23 +217,15 @@ async def submit(
246217
query: t.Optional[t.Mapping[str, t.Any]] = None,
247218
request_cache: t.Optional[bool] = None,
248219
rescore: t.Optional[
249-
t.Union[
250-
t.Mapping[str, t.Any],
251-
t.Union[
252-
t.List[t.Mapping[str, t.Any]], t.Tuple[t.Mapping[str, t.Any], ...]
253-
],
254-
]
220+
t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]]
255221
] = None,
256222
rest_total_hits_as_int: t.Optional[bool] = None,
257223
routing: t.Optional[str] = None,
258224
runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
259225
script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
260226
scroll: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
261227
search_after: t.Optional[
262-
t.Union[
263-
t.List[t.Union[None, bool, float, int, str, t.Any]],
264-
t.Tuple[t.Union[None, bool, float, int, str, t.Any], ...],
265-
]
228+
t.Sequence[t.Union[None, bool, float, int, str, t.Any]]
266229
] = None,
267230
search_type: t.Optional[
268231
t.Union["t.Literal['dfs_query_then_fetch', 'query_then_fetch']", str]
@@ -272,24 +235,15 @@ async def submit(
272235
slice: t.Optional[t.Mapping[str, t.Any]] = None,
273236
sort: t.Optional[
274237
t.Union[
238+
t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
275239
t.Union[str, t.Mapping[str, t.Any]],
276-
t.Union[
277-
t.List[t.Union[str, t.Mapping[str, t.Any]]],
278-
t.Tuple[t.Union[str, t.Mapping[str, t.Any]], ...],
279-
],
280240
]
281241
] = None,
282242
source: t.Optional[t.Union[bool, t.Mapping[str, t.Any]]] = None,
283-
source_excludes: t.Optional[
284-
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
285-
] = None,
286-
source_includes: t.Optional[
287-
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
288-
] = None,
289-
stats: t.Optional[t.Union[t.List[str], t.Tuple[str, ...]]] = None,
290-
stored_fields: t.Optional[
291-
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
292-
] = None,
243+
source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
244+
source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
245+
stats: t.Optional[t.Sequence[str]] = None,
246+
stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
293247
suggest: t.Optional[t.Mapping[str, t.Any]] = None,
294248
suggest_field: t.Optional[str] = None,
295249
suggest_mode: t.Optional[

elasticsearch/_async/client/autoscaling.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ async def delete_autoscaling_policy(
3030
*,
3131
name: str,
3232
error_trace: t.Optional[bool] = None,
33-
filter_path: t.Optional[
34-
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
35-
] = None,
33+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3634
human: t.Optional[bool] = None,
3735
pretty: t.Optional[bool] = None,
3836
) -> ObjectApiResponse[t.Any]:
@@ -66,9 +64,7 @@ async def get_autoscaling_capacity(
6664
self,
6765
*,
6866
error_trace: t.Optional[bool] = None,
69-
filter_path: t.Optional[
70-
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
71-
] = None,
67+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
7268
human: t.Optional[bool] = None,
7369
pretty: t.Optional[bool] = None,
7470
) -> ObjectApiResponse[t.Any]:
@@ -99,9 +95,7 @@ async def get_autoscaling_policy(
9995
*,
10096
name: str,
10197
error_trace: t.Optional[bool] = None,
102-
filter_path: t.Optional[
103-
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
104-
] = None,
98+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
10599
human: t.Optional[bool] = None,
106100
pretty: t.Optional[bool] = None,
107101
) -> ObjectApiResponse[t.Any]:
@@ -139,9 +133,7 @@ async def put_autoscaling_policy(
139133
name: str,
140134
policy: t.Mapping[str, t.Any],
141135
error_trace: t.Optional[bool] = None,
142-
filter_path: t.Optional[
143-
t.Union[str, t.Union[t.List[str], t.Tuple[str, ...]]]
144-
] = None,
136+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
145137
human: t.Optional[bool] = None,
146138
pretty: t.Optional[bool] = None,
147139
) -> ObjectApiResponse[t.Any]:

0 commit comments

Comments
 (0)