diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index 6536d8a22..c82a434b4 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -311,7 +311,6 @@ def __init__( sniff_callback = default_sniff_callback if _transport is None: - requests_session_auth = None if http_auth is not None and http_auth is not DEFAULT: if is_requests_http_auth(http_auth): diff --git a/elasticsearch/_async/client/_base.py b/elasticsearch/_async/client/_base.py index a994534de..ea969b68e 100644 --- a/elasticsearch/_async/client/_base.py +++ b/elasticsearch/_async/client/_base.py @@ -71,7 +71,6 @@ def resolve_auth_headers( basic_auth: Union[DefaultType, None, Tuple[str, str], str] = DEFAULT, bearer_auth: Union[DefaultType, None, str] = DEFAULT, ) -> HttpHeaders: - if headers is None: headers = HttpHeaders() elif not isinstance(headers, HttpHeaders): diff --git a/elasticsearch/_async/helpers.py b/elasticsearch/_async/helpers.py index 969edb142..6e05bc9fc 100644 --- a/elasticsearch/_async/helpers.py +++ b/elasticsearch/_async/helpers.py @@ -176,7 +176,6 @@ async def async_streaming_bulk( *args: Any, **kwargs: Any, ) -> AsyncIterable[Tuple[bool, Dict[str, Any]]]: - """ Streaming bulk consumes actions from the iterable passed in and yields results per action. For non-streaming usecases use @@ -230,7 +229,6 @@ async def map_actions() -> AsyncIterable[_TYPE_BULK_ACTION_HEADER_AND_BODY]: async for bulk_data, bulk_actions in _chunk_actions( map_actions(), chunk_size, max_chunk_bytes, serializer ): - for attempt in range(max_retries + 1): to_retry: List[bytes] = [] to_retry_data: List[ @@ -264,7 +262,6 @@ async def map_actions() -> AsyncIterable[_TYPE_BULK_ACTION_HEADER_AND_BODY]: **kwargs, ), ): - if not ok: action, info = info.popitem() # retry if retries enabled, we get 429, and we are not @@ -509,7 +506,6 @@ async def async_reindex( scan_kwargs: MutableMapping[str, Any] = {}, bulk_kwargs: MutableMapping[str, Any] = {}, ) -> Tuple[int, Union[int, List[Any]]]: - """ Reindex all documents from one index that satisfy a given query to another, potentially (if `target_client` is specified) on a different cluster. diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index 473a5d578..256a14021 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -311,7 +311,6 @@ def __init__( sniff_callback = default_sniff_callback if _transport is None: - requests_session_auth = None if http_auth is not None and http_auth is not DEFAULT: if is_requests_http_auth(http_auth): diff --git a/elasticsearch/_sync/client/_base.py b/elasticsearch/_sync/client/_base.py index ae869db84..934ae47d7 100644 --- a/elasticsearch/_sync/client/_base.py +++ b/elasticsearch/_sync/client/_base.py @@ -71,7 +71,6 @@ def resolve_auth_headers( basic_auth: Union[DefaultType, None, Tuple[str, str], str] = DEFAULT, bearer_auth: Union[DefaultType, None, str] = DEFAULT, ) -> HttpHeaders: - if headers is None: headers = HttpHeaders() elif not isinstance(headers, HttpHeaders): diff --git a/elasticsearch/helpers/actions.py b/elasticsearch/helpers/actions.py index a016c998b..a218c5e8c 100644 --- a/elasticsearch/helpers/actions.py +++ b/elasticsearch/helpers/actions.py @@ -373,7 +373,6 @@ def streaming_bulk( *args: Any, **kwargs: Any, ) -> Iterable[Tuple[bool, Dict[str, Any]]]: - """ Streaming bulk consumes actions from the iterable passed in and yields results per action. For non-streaming usecases use @@ -422,7 +421,6 @@ def streaming_bulk( for bulk_data, bulk_actions in _chunk_actions( map(expand_action_callback, actions), chunk_size, max_chunk_bytes, serializer ): - for attempt in range(max_retries + 1): to_retry: List[bytes] = [] to_retry_data: List[ @@ -448,7 +446,6 @@ def streaming_bulk( **kwargs, ), ): - if not ok: action, info = info.popitem() # retry if retries enabled, we get 429, and we are not @@ -770,7 +767,6 @@ def reindex( scan_kwargs: MutableMapping[str, Any] = {}, bulk_kwargs: MutableMapping[str, Any] = {}, ) -> Tuple[int, Union[int, List[Dict[str, Any]]]]: - """ Reindex all documents from one index that satisfy a given query to another, potentially (if `target_client` is specified) on a different cluster. diff --git a/test_elasticsearch/test_async/test_server/test_helpers.py b/test_elasticsearch/test_async/test_server/test_helpers.py index ecce0dffc..60f789522 100644 --- a/test_elasticsearch/test_async/test_server/test_helpers.py +++ b/test_elasticsearch/test_async/test_server/test_helpers.py @@ -559,7 +559,6 @@ async def test_initial_search_error(self, async_client, scan_teardown): ), ): with patch.object(async_client, "scroll", MockScroll()): - data = [ x async for x in helpers.async_scan( @@ -586,7 +585,6 @@ async def test_initial_search_error(self, async_client, scan_teardown): ), ): with patch.object(async_client, "scroll", MockScroll()) as mock_scroll: - with pytest.raises(ScanError): data = [ x diff --git a/test_elasticsearch/test_server/test_helpers.py b/test_elasticsearch/test_server/test_helpers.py index a74aa205c..8f3dd4949 100644 --- a/test_elasticsearch/test_server/test_helpers.py +++ b/test_elasticsearch/test_server/test_helpers.py @@ -528,7 +528,6 @@ def test_initial_search_error(sync_client): with patch.object(sync_client, "scroll") as scroll_mock, patch.object( sync_client, "clear_scroll" ) as clear_scroll_mock: - scroll_mock.side_effect = mock_scroll_responses data = list( helpers.scan( @@ -549,7 +548,6 @@ def test_initial_search_error(sync_client): with patch.object(sync_client, "scroll") as scroll_mock, patch.object( sync_client, "clear_scroll" ) as clear_scroll_mock: - scroll_mock.side_effect = mock_scroll_responses with pytest.raises(ScanError): data = list( @@ -644,7 +642,6 @@ def test_scan_auth_kwargs_forwarded(sync_client, kwargs): def test_scan_auth_kwargs_favor_scroll_kwargs_option(sync_client): - with patch.object( sync_client, "options", return_value=sync_client ) as options_mock, patch.object( @@ -672,7 +669,6 @@ def test_scan_auth_kwargs_favor_scroll_kwargs_option(sync_client): ) as scroll_mock, patch.object( sync_client, "clear_scroll", return_value=ObjectApiResponse(raw={}, meta=None) ): - data = list( helpers.scan( sync_client,