Skip to content

Commit

Permalink
Fixing lint errors
Browse files Browse the repository at this point in the history
Signed-off-by: Arpit Bandejiya <[email protected]>
  • Loading branch information
Arpit-Bandejiya committed Oct 17, 2022
1 parent faefc8e commit add6177
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def format(session):
session.install("black", "isort")

session.run("isort", "--profile=black", *SOURCE_FILES)
session.run("black", "--target-version=py27", *SOURCE_FILES)
session.run("black", "--target-version=py33", *SOURCE_FILES)
session.run("python", "utils/license-headers.py", "fix", *SOURCE_FILES)

lint(session)
Expand Down
20 changes: 16 additions & 4 deletions opensearchpy/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1953,19 +1953,28 @@ async def list_all_point_in_time(self, params=None, headers=None):
Returns the list of point in times which are alive
"""
return await self.transport.perform_request(
"GET", _make_path("_search", "point_in_time", "_all"), params=params, headers=headers
"GET",
_make_path("_search", "point_in_time", "_all"),
params=params,
headers=headers,
)

@query_params()
async def delete_point_in_time(self, body=None, all=False, params=None, headers=None):
async def delete_point_in_time(
self, body=None, all=False, params=None, headers=None
):
"""
Delete a point in time
:arg body: a point-in-time id to delete
:arg all: set it to `True` to delete all alive point in time.
"""
path = _make_path("_search", "point_in_time", "_all") if all else _make_path("_search", "point_in_time")
path = (
_make_path("_search", "point_in_time", "_all")
if all
else _make_path("_search", "point_in_time")
)
return await self.transport.perform_request(
"DELETE", path, params=params, headers=headers, body=body
)
Expand All @@ -1992,7 +2001,10 @@ async def create_point_in_time(self, index=None, params=None, headers=None):
:arg routing: Specific routing value
"""
return await self.transport.perform_request(
"POST", _make_path(index, "_search", "point_in_time"), params=params, headers=headers
"POST",
_make_path(index, "_search", "point_in_time"),
params=params,
headers=headers,
)

@query_params()
Expand Down
19 changes: 14 additions & 5 deletions opensearchpy/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1952,10 +1952,12 @@ def list_all_point_in_time(self, params=None, headers=None):
Returns the list of active point in times searches
"""
return self.transport.perform_request(
"GET", _make_path("_search", "point_in_time", "_all"), params=params, headers=headers
"GET",
_make_path("_search", "point_in_time", "_all"),
params=params,
headers=headers,
)


@query_params()
def delete_point_in_time(self, body=None, all=False, params=None, headers=None):
"""
Expand All @@ -1966,9 +1968,13 @@ def delete_point_in_time(self, body=None, all=False, params=None, headers=None):
:arg all: set it to `True` to delete all alive point in time.
"""

path = _make_path("_search", "point_in_time", "_all") if all else _make_path("_search", "point_in_time")
path = (
_make_path("_search", "point_in_time", "_all")
if all
else _make_path("_search", "point_in_time")
)
return self.transport.perform_request(
"DELETE", path, params=params, headers=headers, body=body
"DELETE", path, params=params, headers=headers, body=body
)

@query_params(
Expand All @@ -1993,7 +1999,10 @@ def create_point_in_time(self, index=None, params=None, headers=None):
:arg routing: Specific routing value
"""
return self.transport.perform_request(
"POST", _make_path(index, "_search", "point_in_time"), params=params, headers=headers
"POST",
_make_path(index, "_search", "point_in_time"),
params=params,
headers=headers,
)

@query_params()
Expand Down
4 changes: 1 addition & 3 deletions test_opensearchpy/test_client/test_point_in_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ def test_create_one_point_in_time(self):
self.assert_url_called("POST", "/test-index/_search/point_in_time")

def test_delete_one_point_in_time(self):
self.client.delete_point_in_time(body={
"pit_id": ["Sample-PIT-ID"]
})
self.client.delete_point_in_time(body={"pit_id": ["Sample-PIT-ID"]})
self.assert_url_called("DELETE", "/_search/point_in_time")

def test_delete_all_point_in_time(self):
Expand Down

0 comments on commit add6177

Please sign in to comment.