Skip to content

Commit

Permalink
[8.0] Fix type ignores for new Mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmlarson committed Jan 14, 2022
1 parent dceb034 commit aad778f
Show file tree
Hide file tree
Showing 72 changed files with 2,246 additions and 750 deletions.
168 changes: 126 additions & 42 deletions elasticsearch/_async/client/__init__.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion elasticsearch/_async/client/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ async def perform_request(
params: Optional[Mapping[str, Any]] = None,
headers: Optional[Mapping[str, str]] = None,
body: Optional[Any] = None,
) -> Any:
) -> ApiResponse[Any]:
# Use the internal clients .perform_request() implementation
# so we take advantage of their transport options.
return await self._client.perform_request(
Expand Down
16 changes: 12 additions & 4 deletions elasticsearch/_async/client/async_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ async def delete(
if pretty is not None:
__query["pretty"] = pretty
__headers = {"accept": "application/json"}
return await self.perform_request("DELETE", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"DELETE", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def get(
Expand Down Expand Up @@ -103,7 +105,9 @@ async def get(
if wait_for_completion_timeout is not None:
__query["wait_for_completion_timeout"] = wait_for_completion_timeout
__headers = {"accept": "application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def status(
Expand Down Expand Up @@ -136,7 +140,9 @@ async def status(
if pretty is not None:
__query["pretty"] = pretty
__headers = {"accept": "application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters(
body_fields=True,
Expand Down Expand Up @@ -488,4 +494,6 @@ async def submit(
__headers = {"accept": "application/json"}
if __body is not None:
__headers["content-type"] = "application/json"
return await self.perform_request("POST", __path, params=__query, headers=__headers, body=__body) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"POST", __path, params=__query, headers=__headers, body=__body
)
16 changes: 12 additions & 4 deletions elasticsearch/_async/client/autoscaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ async def delete_autoscaling_policy(
if pretty is not None:
__query["pretty"] = pretty
__headers = {"accept": "application/json"}
return await self.perform_request("DELETE", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"DELETE", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def get_autoscaling_capacity(
Expand Down Expand Up @@ -83,7 +85,9 @@ async def get_autoscaling_capacity(
if pretty is not None:
__query["pretty"] = pretty
__headers = {"accept": "application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def get_autoscaling_policy(
Expand Down Expand Up @@ -116,7 +120,9 @@ async def get_autoscaling_policy(
if pretty is not None:
__query["pretty"] = pretty
__headers = {"accept": "application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters(
body_name="policy",
Expand Down Expand Up @@ -156,4 +162,6 @@ async def put_autoscaling_policy(
__query["pretty"] = pretty
__body = policy
__headers = {"accept": "application/json", "content-type": "application/json"}
return await self.perform_request("PUT", __path, params=__query, headers=__headers, body=__body) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"PUT", __path, params=__query, headers=__headers, body=__body
)
100 changes: 75 additions & 25 deletions elasticsearch/_async/client/cat.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ async def aliases(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def allocation(
Expand Down Expand Up @@ -170,7 +172,9 @@ async def allocation(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def count(
Expand Down Expand Up @@ -239,7 +243,9 @@ async def count(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def fielddata(
Expand Down Expand Up @@ -312,7 +318,9 @@ async def fielddata(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def health(
Expand Down Expand Up @@ -379,7 +387,9 @@ async def health(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def help(
Expand Down Expand Up @@ -442,7 +452,9 @@ async def help(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def indices(
Expand Down Expand Up @@ -534,7 +546,9 @@ async def indices(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def master(
Expand Down Expand Up @@ -597,7 +611,9 @@ async def master(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def ml_data_frame_analytics(
Expand Down Expand Up @@ -674,7 +690,9 @@ async def ml_data_frame_analytics(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def ml_datafeeds(
Expand Down Expand Up @@ -759,7 +777,9 @@ async def ml_datafeeds(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def ml_jobs(
Expand Down Expand Up @@ -845,7 +865,9 @@ async def ml_jobs(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters(
parameter_aliases={"from": "from_"},
Expand Down Expand Up @@ -933,7 +955,9 @@ async def ml_trained_models(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def nodeattrs(
Expand Down Expand Up @@ -996,7 +1020,9 @@ async def nodeattrs(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def nodes(
Expand Down Expand Up @@ -1068,7 +1094,9 @@ async def nodes(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def pending_tasks(
Expand Down Expand Up @@ -1131,7 +1159,9 @@ async def pending_tasks(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def plugins(
Expand Down Expand Up @@ -1194,7 +1224,9 @@ async def plugins(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def recovery(
Expand Down Expand Up @@ -1276,7 +1308,9 @@ async def recovery(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def repositories(
Expand Down Expand Up @@ -1339,7 +1373,9 @@ async def repositories(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def segments(
Expand Down Expand Up @@ -1411,7 +1447,9 @@ async def segments(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def shards(
Expand Down Expand Up @@ -1483,7 +1521,9 @@ async def shards(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def snapshots(
Expand Down Expand Up @@ -1555,7 +1595,9 @@ async def snapshots(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def tasks(
Expand Down Expand Up @@ -1636,7 +1678,9 @@ async def tasks(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def templates(
Expand Down Expand Up @@ -1704,7 +1748,9 @@ async def templates(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters()
async def thread_pool(
Expand Down Expand Up @@ -1778,7 +1824,9 @@ async def thread_pool(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)

@_rewrite_parameters(
parameter_aliases={"from": "from_"},
Expand Down Expand Up @@ -1863,4 +1911,6 @@ async def transforms(
if v is not None:
__query["v"] = v
__headers = {"accept": "text/plain,application/json"}
return await self.perform_request("GET", __path, params=__query, headers=__headers) # type: ignore[no-any-return,return-value]
return await self.perform_request( # type: ignore[return-value]
"GET", __path, params=__query, headers=__headers
)
Loading

0 comments on commit aad778f

Please sign in to comment.