From 693feb0220d234bdcd7f2d8d0201915e64e0dc6a Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Thu, 18 Dec 2025 09:55:35 +0000 Subject: [PATCH] Auto-generated API code --- elasticsearch/_async/client/__init__.py | 66 ++----- elasticsearch/_async/client/ccr.py | 18 +- elasticsearch/_async/client/cluster.py | 12 +- elasticsearch/_async/client/connector.py | 108 ++--------- elasticsearch/_async/client/enrich.py | 6 +- elasticsearch/_async/client/eql.py | 6 +- elasticsearch/_async/client/esql.py | 12 +- elasticsearch/_async/client/fleet.py | 6 +- elasticsearch/_async/client/graph.py | 6 +- elasticsearch/_async/client/ilm.py | 12 +- elasticsearch/_async/client/indices.py | 60 ++----- elasticsearch/_async/client/inference.py | 144 +++------------ elasticsearch/_async/client/ingest.py | 18 +- elasticsearch/_async/client/ml.py | 102 ++--------- elasticsearch/_async/client/query_rules.py | 18 +- elasticsearch/_async/client/rollup.py | 12 +- .../_async/client/searchable_snapshots.py | 6 +- elasticsearch/_async/client/security.py | 168 +++--------------- elasticsearch/_async/client/shutdown.py | 6 +- elasticsearch/_async/client/simulate.py | 6 +- elasticsearch/_async/client/slm.py | 6 +- elasticsearch/_async/client/snapshot.py | 6 +- elasticsearch/_async/client/sql.py | 18 +- elasticsearch/_async/client/synonyms.py | 12 +- elasticsearch/_async/client/text_structure.py | 12 +- elasticsearch/_async/client/transform.py | 12 +- elasticsearch/_async/client/watcher.py | 12 +- elasticsearch/_sync/client/__init__.py | 66 ++----- elasticsearch/_sync/client/ccr.py | 18 +- elasticsearch/_sync/client/cluster.py | 12 +- elasticsearch/_sync/client/connector.py | 108 ++--------- elasticsearch/_sync/client/enrich.py | 6 +- elasticsearch/_sync/client/eql.py | 6 +- elasticsearch/_sync/client/esql.py | 12 +- elasticsearch/_sync/client/fleet.py | 6 +- elasticsearch/_sync/client/graph.py | 6 +- elasticsearch/_sync/client/ilm.py | 12 +- elasticsearch/_sync/client/indices.py | 60 ++----- elasticsearch/_sync/client/inference.py | 144 +++------------ elasticsearch/_sync/client/ingest.py | 18 +- elasticsearch/_sync/client/ml.py | 102 ++--------- elasticsearch/_sync/client/query_rules.py | 18 +- elasticsearch/_sync/client/rollup.py | 12 +- .../_sync/client/searchable_snapshots.py | 6 +- elasticsearch/_sync/client/security.py | 168 +++--------------- elasticsearch/_sync/client/shutdown.py | 6 +- elasticsearch/_sync/client/simulate.py | 6 +- elasticsearch/_sync/client/slm.py | 6 +- elasticsearch/_sync/client/snapshot.py | 6 +- elasticsearch/_sync/client/sql.py | 18 +- elasticsearch/_sync/client/synonyms.py | 12 +- elasticsearch/_sync/client/text_structure.py | 12 +- elasticsearch/_sync/client/transform.py | 12 +- elasticsearch/_sync/client/watcher.py | 12 +- elasticsearch/_version.py | 2 +- 55 files changed, 291 insertions(+), 1451 deletions(-) diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index db05a3cd8..34f6d58ee 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -853,11 +853,7 @@ async def close_point_in_time( if not __body: if id is not None: __body["id"] = id - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "DELETE", __path, @@ -1627,11 +1623,7 @@ async def delete_by_query( __body["slice"] = slice if sort is not None: __body["sort"] = sort - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3118,11 +3110,7 @@ async def mget( __body["docs"] = docs if ids is not None: __body["ids"] = ids - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3722,11 +3710,7 @@ async def put_script( if not __body: if script is not None: __body["script"] = script - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3822,11 +3806,7 @@ async def rank_eval( __body["requests"] = requests if metric is not None: __body["metric"] = metric - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3999,11 +3979,7 @@ async def reindex( __body["script"] = script if size is not None: __body["size"] = size - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4131,11 +4107,7 @@ async def render_search_template( __body["params"] = params if source is not None: __body["source"] = source - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4218,11 +4190,7 @@ async def scripts_painless_execute( __body["context_setup"] = context_setup if script is not None: __body["script"] = script - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5556,11 +5524,7 @@ async def search_template( __body["profile"] = profile if source is not None: __body["source"] = source - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5665,11 +5629,7 @@ async def terms_enum( __body["string"] = string if timeout is not None: __body["timeout"] = timeout - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -6031,11 +5991,7 @@ async def update( __body["_source"] = source if upsert is not None: __body["upsert"] = upsert - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/ccr.py b/elasticsearch/_async/client/ccr.py index 821b79ee5..f87ce10cf 100644 --- a/elasticsearch/_async/client/ccr.py +++ b/elasticsearch/_async/client/ccr.py @@ -229,11 +229,7 @@ async def follow( __body["read_poll_timeout"] = read_poll_timeout if settings is not None: __body["settings"] = settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -420,11 +416,7 @@ async def forget_follower( __body["follower_index_uuid"] = follower_index_uuid if leader_remote_cluster is not None: __body["leader_remote_cluster"] = leader_remote_cluster - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -759,11 +751,7 @@ async def put_auto_follow_pattern( __body["read_poll_timeout"] = read_poll_timeout if settings is not None: __body["settings"] = settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_async/client/cluster.py b/elasticsearch/_async/client/cluster.py index de493e21e..7f1cdad32 100644 --- a/elasticsearch/_async/client/cluster.py +++ b/elasticsearch/_async/client/cluster.py @@ -834,11 +834,7 @@ async def put_component_template( __body["_meta"] = meta if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -916,11 +912,7 @@ async def put_settings( __body["persistent"] = persistent if transient is not None: __body["transient"] = transient - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_async/client/connector.py b/elasticsearch/_async/client/connector.py index 26563bfc1..19a4c382b 100644 --- a/elasticsearch/_async/client/connector.py +++ b/elasticsearch/_async/client/connector.py @@ -320,11 +320,7 @@ async def last_sync( __body["last_synced"] = last_synced if sync_cursor is not None: __body["sync_cursor"] = sync_cursor - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -746,11 +742,7 @@ async def sync_job_claim( __body["worker_hostname"] = worker_hostname if sync_cursor is not None: __body["sync_cursor"] = sync_cursor - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -860,11 +852,7 @@ async def sync_job_error( if not __body: if error is not None: __body["error"] = error - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1058,11 +1046,7 @@ async def sync_job_post( __body["job_type"] = job_type if trigger_method is not None: __body["trigger_method"] = trigger_method - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -1165,11 +1149,7 @@ async def sync_job_update_stats( __body["metadata"] = metadata if total_document_count is not None: __body["total_document_count"] = total_document_count - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1276,11 +1256,7 @@ async def update_api_key_id( __body["api_key_id"] = api_key_id if api_key_secret_id is not None: __body["api_key_secret_id"] = api_key_secret_id - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1339,11 +1315,7 @@ async def update_configuration( __body["configuration"] = configuration if values is not None: __body["values"] = values - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1402,11 +1374,7 @@ async def update_error( if not __body: if error is not None: __body["error"] = error - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1474,11 +1442,7 @@ async def update_features( if not __body: if features is not None: __body["features"] = features - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1543,11 +1507,7 @@ async def update_filtering( __body["filtering"] = filtering if rules is not None: __body["rules"] = rules - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1604,11 +1564,7 @@ async def update_filtering_validation( if not __body: if validation is not None: __body["validation"] = validation - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1665,11 +1621,7 @@ async def update_index_name( if not __body: if index_name is not None: __body["index_name"] = index_name - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1727,11 +1679,7 @@ async def update_name( __body["description"] = description if name is not None: __body["name"] = name - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1787,11 +1735,7 @@ async def update_native( if not __body: if is_native is not None: __body["is_native"] = is_native - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1848,11 +1792,7 @@ async def update_pipeline( if not __body: if pipeline is not None: __body["pipeline"] = pipeline - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1908,11 +1848,7 @@ async def update_scheduling( if not __body: if scheduling is not None: __body["scheduling"] = scheduling - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1968,11 +1904,7 @@ async def update_service_type( if not __body: if service_type is not None: __body["service_type"] = service_type - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2035,11 +1967,7 @@ async def update_status( if not __body: if status is not None: __body["status"] = status - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_async/client/enrich.py b/elasticsearch/_async/client/enrich.py index da8c8a61a..19dd27f14 100644 --- a/elasticsearch/_async/client/enrich.py +++ b/elasticsearch/_async/client/enrich.py @@ -235,11 +235,7 @@ async def put_policy( __body["match"] = match if range is not None: __body["range"] = range - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_async/client/eql.py b/elasticsearch/_async/client/eql.py index c1f3a9893..f734cfdc9 100644 --- a/elasticsearch/_async/client/eql.py +++ b/elasticsearch/_async/client/eql.py @@ -355,11 +355,7 @@ async def search( __body["timestamp_field"] = timestamp_field if wait_for_completion_timeout is not None: __body["wait_for_completion_timeout"] = wait_for_completion_timeout - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/esql.py b/elasticsearch/_async/client/esql.py index c150a8b18..9975a30f0 100644 --- a/elasticsearch/_async/client/esql.py +++ b/elasticsearch/_async/client/esql.py @@ -194,11 +194,7 @@ async def async_query( __body["tables"] = tables if wait_for_completion_timeout is not None: __body["wait_for_completion_timeout"] = wait_for_completion_timeout - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -612,11 +608,7 @@ async def query( __body["profile"] = profile if tables is not None: __body["tables"] = tables - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/fleet.py b/elasticsearch/_async/client/fleet.py index 20d57d928..27d68fb41 100644 --- a/elasticsearch/_async/client/fleet.py +++ b/elasticsearch/_async/client/fleet.py @@ -642,11 +642,7 @@ async def search( __body["track_total_hits"] = track_total_hits if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/graph.py b/elasticsearch/_async/client/graph.py index aaf82c0b0..ad4ce8a80 100644 --- a/elasticsearch/_async/client/graph.py +++ b/elasticsearch/_async/client/graph.py @@ -97,11 +97,7 @@ async def explore( __body["query"] = query if vertices is not None: __body["vertices"] = vertices - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/ilm.py b/elasticsearch/_async/client/ilm.py index 011fa95e9..e0784f194 100644 --- a/elasticsearch/_async/client/ilm.py +++ b/elasticsearch/_async/client/ilm.py @@ -383,11 +383,7 @@ async def move_to_step( __body["current_step"] = current_step if next_step is not None: __body["next_step"] = next_step - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -453,11 +449,7 @@ async def put_lifecycle( if not __body: if policy is not None: __body["policy"] = policy - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_async/client/indices.py b/elasticsearch/_async/client/indices.py index 988efd88f..c3fab8b84 100644 --- a/elasticsearch/_async/client/indices.py +++ b/elasticsearch/_async/client/indices.py @@ -232,11 +232,7 @@ async def analyze( __body["text"] = text if tokenizer is not None: __body["tokenizer"] = tokenizer - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3273,11 +3269,7 @@ async def modify_data_stream( if not __body: if actions is not None: __body["actions"] = actions - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3642,11 +3634,7 @@ async def put_data_lifecycle( __body["downsampling"] = downsampling if enabled is not None: __body["enabled"] = enabled - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3725,11 +3713,7 @@ async def put_data_stream_options( if not __body: if failure_store is not None: __body["failure_store"] = failure_store - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3970,11 +3954,7 @@ async def put_index_template( __body["template"] = template if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4149,11 +4129,7 @@ async def put_mapping( __body["runtime"] = runtime if source is not None: __body["_source"] = source - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4422,11 +4398,7 @@ async def put_template( __body["settings"] = settings if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -5416,11 +5388,7 @@ async def shrink( __body["aliases"] = aliases if settings is not None: __body["settings"] = settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -5772,11 +5740,7 @@ async def split( __body["aliases"] = aliases if settings is not None: __body["settings"] = settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -5956,11 +5920,7 @@ async def update_aliases( if not __body: if actions is not None: __body["actions"] = actions - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/inference.py b/elasticsearch/_async/client/inference.py index 86380cc3f..d5d7d420e 100644 --- a/elasticsearch/_async/client/inference.py +++ b/elasticsearch/_async/client/inference.py @@ -78,11 +78,7 @@ async def completion( __body["input"] = input if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -338,11 +334,7 @@ async def inference( __body["query"] = query if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -546,11 +538,7 @@ async def put_alibabacloud( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -646,11 +634,7 @@ async def put_amazonbedrock( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -752,11 +736,7 @@ async def put_amazonsagemaker( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -849,11 +829,7 @@ async def put_anthropic( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -945,11 +921,7 @@ async def put_azureaistudio( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1049,11 +1021,7 @@ async def put_azureopenai( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1143,11 +1111,7 @@ async def put_cohere( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1274,11 +1238,7 @@ async def put_custom( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1358,11 +1318,7 @@ async def put_deepseek( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1470,11 +1426,7 @@ async def put_elasticsearch( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1568,11 +1520,7 @@ async def put_elser( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1654,11 +1602,7 @@ async def put_googleaistudio( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1752,11 +1696,7 @@ async def put_googlevertexai( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1884,11 +1824,7 @@ async def put_hugging_face( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1980,11 +1916,7 @@ async def put_jinaai( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2066,11 +1998,7 @@ async def put_mistral( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2164,11 +2092,7 @@ async def put_openai( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2259,11 +2183,7 @@ async def put_voyageai( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2343,11 +2263,7 @@ async def put_watsonx( __body["service"] = service if service_settings is not None: __body["service_settings"] = service_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2420,11 +2336,7 @@ async def rerank( __body["query"] = query if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2488,11 +2400,7 @@ async def sparse_embedding( __body["input"] = input if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2566,11 +2474,7 @@ async def text_embedding( __body["input_type"] = input_type if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/ingest.py b/elasticsearch/_async/client/ingest.py index 62f0bd084..d68eec651 100644 --- a/elasticsearch/_async/client/ingest.py +++ b/elasticsearch/_async/client/ingest.py @@ -494,11 +494,7 @@ async def put_geoip_database( __body["maxmind"] = maxmind if name is not None: __body["name"] = name - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -679,11 +675,7 @@ async def put_pipeline( __body["processors"] = processors if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -755,11 +747,7 @@ async def simulate( __body["docs"] = docs if pipeline is not None: __body["pipeline"] = pipeline - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/ml.py b/elasticsearch/_async/client/ml.py index 99a0f387d..a14a17b63 100644 --- a/elasticsearch/_async/client/ml.py +++ b/elasticsearch/_async/client/ml.py @@ -887,11 +887,7 @@ async def estimate_model_memory( __body["max_bucket_cardinality"] = max_bucket_cardinality if overall_cardinality is not None: __body["overall_cardinality"] = overall_cardinality - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -957,11 +953,7 @@ async def evaluate_data_frame( __body["index"] = index if query is not None: __body["query"] = query - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2828,11 +2820,7 @@ async def infer_trained_model( __body["docs"] = docs if inference_config is not None: __body["inference_config"] = inference_config - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2997,11 +2985,7 @@ async def post_calendar_events( if not __body: if events is not None: __body["events"] = events - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3493,11 +3477,7 @@ async def put_data_frame_analytics( __body["model_memory_limit"] = model_memory_limit if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3709,11 +3689,7 @@ async def put_datafeed( __body["script_fields"] = script_fields if scroll_size is not None: __body["scroll_size"] = scroll_size - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3773,11 +3749,7 @@ async def put_filter( __body["description"] = description if items is not None: __body["items"] = items - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3997,11 +3969,7 @@ async def put_job( __body["results_index_name"] = results_index_name if results_retention_days is not None: __body["results_retention_days"] = results_retention_days - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4135,11 +4103,7 @@ async def put_trained_model( __body["prefix_strings"] = prefix_strings if tags is not None: __body["tags"] = tags - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4292,11 +4256,7 @@ async def put_trained_model_definition_part( __body["total_definition_length"] = total_definition_length if total_parts is not None: __body["total_parts"] = total_parts - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4361,11 +4321,7 @@ async def put_trained_model_vocabulary( __body["merges"] = merges if scores is not None: __body["scores"] = scores - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -5116,11 +5072,7 @@ async def update_data_frame_analytics( __body["max_num_threads"] = max_num_threads if model_memory_limit is not None: __body["model_memory_limit"] = model_memory_limit - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5321,11 +5273,7 @@ async def update_datafeed( __body["script_fields"] = script_fields if scroll_size is not None: __body["scroll_size"] = scroll_size - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5387,11 +5335,7 @@ async def update_filter( __body["description"] = description if remove_items is not None: __body["remove_items"] = remove_items - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5555,11 +5499,7 @@ async def update_job( __body["renormalization_window_days"] = renormalization_window_days if results_retention_days is not None: __body["results_retention_days"] = results_retention_days - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5626,11 +5566,7 @@ async def update_model_snapshot( __body["description"] = description if retain is not None: __body["retain"] = retain - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5862,11 +5798,7 @@ async def validate( __body["model_snapshot_retention_days"] = model_snapshot_retention_days if results_index_name is not None: __body["results_index_name"] = results_index_name - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/query_rules.py b/elasticsearch/_async/client/query_rules.py index 8f75ba325..ec9d478f4 100644 --- a/elasticsearch/_async/client/query_rules.py +++ b/elasticsearch/_async/client/query_rules.py @@ -350,11 +350,7 @@ async def put_rule( __body["type"] = type if priority is not None: __body["priority"] = priority - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -418,11 +414,7 @@ async def put_ruleset( if not __body: if rules is not None: __body["rules"] = rules - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -481,11 +473,7 @@ async def test( if not __body: if match_criteria is not None: __body["match_criteria"] = match_criteria - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/rollup.py b/elasticsearch/_async/client/rollup.py index 70d34171f..75d9f70b2 100644 --- a/elasticsearch/_async/client/rollup.py +++ b/elasticsearch/_async/client/rollup.py @@ -378,11 +378,7 @@ async def put_job( __body["metrics"] = metrics if timeout is not None: __body["timeout"] = timeout - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -474,11 +470,7 @@ async def rollup_search( __body["query"] = query if size is not None: __body["size"] = size - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/searchable_snapshots.py b/elasticsearch/_async/client/searchable_snapshots.py index e3d77d6d2..539932dd3 100644 --- a/elasticsearch/_async/client/searchable_snapshots.py +++ b/elasticsearch/_async/client/searchable_snapshots.py @@ -248,11 +248,7 @@ async def mount( __body["index_settings"] = index_settings if renamed_index is not None: __body["renamed_index"] = renamed_index - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/security.py b/elasticsearch/_async/client/security.py index ed2e515ab..793915030 100644 --- a/elasticsearch/_async/client/security.py +++ b/elasticsearch/_async/client/security.py @@ -94,11 +94,7 @@ async def activate_user_profile( __body["password"] = password if username is not None: __body["username"] = username - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -201,11 +197,7 @@ async def bulk_delete_role( if not __body: if names is not None: __body["names"] = names - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "DELETE", __path, @@ -266,11 +258,7 @@ async def bulk_put_role( if not __body: if roles is not None: __body["roles"] = roles - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -354,11 +342,7 @@ async def bulk_update_api_keys( __body["metadata"] = metadata if role_descriptors is not None: __body["role_descriptors"] = role_descriptors - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -432,11 +416,7 @@ async def change_password( __body["password"] = password if password_hash is not None: __body["password_hash"] = password_hash - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -783,11 +763,7 @@ async def create_api_key( __body["name"] = name if role_descriptors is not None: __body["role_descriptors"] = role_descriptors - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -869,11 +845,7 @@ async def create_cross_cluster_api_key( __body["expiration"] = expiration if metadata is not None: __body["metadata"] = metadata - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -1022,11 +994,7 @@ async def delegate_pki( if not __body: if x509_certificate_chain is not None: __body["x509_certificate_chain"] = x509_certificate_chain - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2176,11 +2144,7 @@ async def get_token( __body["scope"] = scope if username is not None: __body["username"] = username - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2444,11 +2408,7 @@ async def grant_api_key( __body["run_as"] = run_as if username is not None: __body["username"] = username - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2584,11 +2544,7 @@ async def has_privileges( __body["cluster"] = cluster if index is not None: __body["index"] = index - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2649,11 +2605,7 @@ async def has_privileges_user_profile( __body["privileges"] = privileges if uids is not None: __body["uids"] = uids - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2742,11 +2694,7 @@ async def invalidate_api_key( __body["realm_name"] = realm_name if username is not None: __body["username"] = username - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "DELETE", __path, @@ -2820,11 +2768,7 @@ async def invalidate_token( __body["token"] = token if username is not None: __body["username"] = username - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "DELETE", __path, @@ -2905,11 +2849,7 @@ async def oidc_authenticate( __body["state"] = state if realm is not None: __body["realm"] = realm - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2968,11 +2908,7 @@ async def oidc_logout( __body["token"] = token if refresh_token is not None: __body["refresh_token"] = refresh_token - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3055,11 +2991,7 @@ async def oidc_prepare_authentication( __body["realm"] = realm if state is not None: __body["state"] = state - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3336,11 +3268,7 @@ async def put_role( __body["run_as"] = run_as if transient_metadata is not None: __body["transient_metadata"] = transient_metadata - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3454,11 +3382,7 @@ async def put_role_mapping( __body["rules"] = rules if run_as is not None: __body["run_as"] = run_as - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3568,11 +3492,7 @@ async def put_user( __body["password_hash"] = password_hash if roles is not None: __body["roles"] = roles - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3995,11 +3915,7 @@ async def saml_authenticate( __body["ids"] = ids if realm is not None: __body["realm"] = realm - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4077,11 +3993,7 @@ async def saml_complete_logout( __body["content"] = content if query_string is not None: __body["query_string"] = query_string - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4159,11 +4071,7 @@ async def saml_invalidate( __body["acs"] = acs if realm is not None: __body["realm"] = realm - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4227,11 +4135,7 @@ async def saml_logout( __body["token"] = token if refresh_token is not None: __body["refresh_token"] = refresh_token - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4304,11 +4208,7 @@ async def saml_prepare_authentication( __body["realm"] = realm if relay_state is not None: __body["relay_state"] = relay_state - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4604,11 +4504,7 @@ async def update_cross_cluster_api_key( __body["expiration"] = expiration if metadata is not None: __body["metadata"] = metadata - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4685,11 +4581,7 @@ async def update_settings( __body["security-profile"] = security_profile if security_tokens is not None: __body["security-tokens"] = security_tokens - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4783,11 +4675,7 @@ async def update_user_profile_data( __body["data"] = data if labels is not None: __body["labels"] = labels - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_async/client/shutdown.py b/elasticsearch/_async/client/shutdown.py index 66412592d..697a95d49 100644 --- a/elasticsearch/_async/client/shutdown.py +++ b/elasticsearch/_async/client/shutdown.py @@ -251,11 +251,7 @@ async def put_node( __body["allocation_delay"] = allocation_delay if target_node_name is not None: __body["target_node_name"] = target_node_name - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_async/client/simulate.py b/elasticsearch/_async/client/simulate.py index d94600ca3..fda8ca507 100644 --- a/elasticsearch/_async/client/simulate.py +++ b/elasticsearch/_async/client/simulate.py @@ -133,11 +133,7 @@ async def ingest( __body["mapping_addition"] = mapping_addition if pipeline_substitutions is not None: __body["pipeline_substitutions"] = pipeline_substitutions - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/slm.py b/elasticsearch/_async/client/slm.py index dd8ef80dc..a157eb73e 100644 --- a/elasticsearch/_async/client/slm.py +++ b/elasticsearch/_async/client/slm.py @@ -431,11 +431,7 @@ async def put_lifecycle( __body["retention"] = retention if schedule is not None: __body["schedule"] = schedule - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_async/client/snapshot.py b/elasticsearch/_async/client/snapshot.py index f25b90811..0edd2620b 100644 --- a/elasticsearch/_async/client/snapshot.py +++ b/elasticsearch/_async/client/snapshot.py @@ -155,11 +155,7 @@ async def clone( if not __body: if indices is not None: __body["indices"] = indices - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_async/client/sql.py b/elasticsearch/_async/client/sql.py index 5ec4304a2..133844023 100644 --- a/elasticsearch/_async/client/sql.py +++ b/elasticsearch/_async/client/sql.py @@ -65,11 +65,7 @@ async def clear_cursor( if not __body: if cursor is not None: __body["cursor"] = cursor - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -396,11 +392,7 @@ async def query( __body["time_zone"] = time_zone if wait_for_completion_timeout is not None: __body["wait_for_completion_timeout"] = wait_for_completion_timeout - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -465,11 +457,7 @@ async def translate( __body["filter"] = filter if time_zone is not None: __body["time_zone"] = time_zone - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/synonyms.py b/elasticsearch/_async/client/synonyms.py index 999d0f7a9..34edb0c77 100644 --- a/elasticsearch/_async/client/synonyms.py +++ b/elasticsearch/_async/client/synonyms.py @@ -348,11 +348,7 @@ async def put_synonym( if not __body: if synonyms_set is not None: __body["synonyms_set"] = synonyms_set - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -424,11 +420,7 @@ async def put_synonym_rule( if not __body: if synonyms is not None: __body["synonyms"] = synonyms - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_async/client/text_structure.py b/elasticsearch/_async/client/text_structure.py index 5a7084092..98d3cbf82 100644 --- a/elasticsearch/_async/client/text_structure.py +++ b/elasticsearch/_async/client/text_structure.py @@ -378,11 +378,7 @@ async def find_message_structure( if not __body: if messages is not None: __body["messages"] = messages - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, @@ -660,11 +656,7 @@ async def test_grok_pattern( __body["grok_pattern"] = grok_pattern if text is not None: __body["text"] = text - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/transform.py b/elasticsearch/_async/client/transform.py index 3a2f3d18e..165ddf6d1 100644 --- a/elasticsearch/_async/client/transform.py +++ b/elasticsearch/_async/client/transform.py @@ -520,11 +520,7 @@ async def put_transform( __body["settings"] = settings if sync is not None: __body["sync"] = sync - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -954,11 +950,7 @@ async def update_transform( __body["source"] = source if sync is not None: __body["sync"] = sync - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_async/client/watcher.py b/elasticsearch/_async/client/watcher.py index ad1cf7761..147d235bd 100644 --- a/elasticsearch/_async/client/watcher.py +++ b/elasticsearch/_async/client/watcher.py @@ -552,11 +552,7 @@ async def put_watch( __body["transform"] = transform if trigger is not None: __body["trigger"] = trigger - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -884,11 +880,7 @@ async def update_settings( __body["index.auto_expand_replicas"] = index_auto_expand_replicas if index_number_of_replicas is not None: __body["index.number_of_replicas"] = index_number_of_replicas - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return await self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index d178dfe6f..bdec16efd 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -853,11 +853,7 @@ def close_point_in_time( if not __body: if id is not None: __body["id"] = id - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "DELETE", __path, @@ -1627,11 +1623,7 @@ def delete_by_query( __body["slice"] = slice if sort is not None: __body["sort"] = sort - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3118,11 +3110,7 @@ def mget( __body["docs"] = docs if ids is not None: __body["ids"] = ids - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3722,11 +3710,7 @@ def put_script( if not __body: if script is not None: __body["script"] = script - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3822,11 +3806,7 @@ def rank_eval( __body["requests"] = requests if metric is not None: __body["metric"] = metric - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3999,11 +3979,7 @@ def reindex( __body["script"] = script if size is not None: __body["size"] = size - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4131,11 +4107,7 @@ def render_search_template( __body["params"] = params if source is not None: __body["source"] = source - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4218,11 +4190,7 @@ def scripts_painless_execute( __body["context_setup"] = context_setup if script is not None: __body["script"] = script - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5556,11 +5524,7 @@ def search_template( __body["profile"] = profile if source is not None: __body["source"] = source - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5665,11 +5629,7 @@ def terms_enum( __body["string"] = string if timeout is not None: __body["timeout"] = timeout - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -6031,11 +5991,7 @@ def update( __body["_source"] = source if upsert is not None: __body["upsert"] = upsert - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/ccr.py b/elasticsearch/_sync/client/ccr.py index e94adc10e..37699bacc 100644 --- a/elasticsearch/_sync/client/ccr.py +++ b/elasticsearch/_sync/client/ccr.py @@ -229,11 +229,7 @@ def follow( __body["read_poll_timeout"] = read_poll_timeout if settings is not None: __body["settings"] = settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -420,11 +416,7 @@ def forget_follower( __body["follower_index_uuid"] = follower_index_uuid if leader_remote_cluster is not None: __body["leader_remote_cluster"] = leader_remote_cluster - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -759,11 +751,7 @@ def put_auto_follow_pattern( __body["read_poll_timeout"] = read_poll_timeout if settings is not None: __body["settings"] = settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/cluster.py b/elasticsearch/_sync/client/cluster.py index d2813d6d9..68499f3ee 100644 --- a/elasticsearch/_sync/client/cluster.py +++ b/elasticsearch/_sync/client/cluster.py @@ -834,11 +834,7 @@ def put_component_template( __body["_meta"] = meta if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -916,11 +912,7 @@ def put_settings( __body["persistent"] = persistent if transient is not None: __body["transient"] = transient - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/connector.py b/elasticsearch/_sync/client/connector.py index a8f56a59d..ac8e77ae1 100644 --- a/elasticsearch/_sync/client/connector.py +++ b/elasticsearch/_sync/client/connector.py @@ -320,11 +320,7 @@ def last_sync( __body["last_synced"] = last_synced if sync_cursor is not None: __body["sync_cursor"] = sync_cursor - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -746,11 +742,7 @@ def sync_job_claim( __body["worker_hostname"] = worker_hostname if sync_cursor is not None: __body["sync_cursor"] = sync_cursor - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -860,11 +852,7 @@ def sync_job_error( if not __body: if error is not None: __body["error"] = error - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1058,11 +1046,7 @@ def sync_job_post( __body["job_type"] = job_type if trigger_method is not None: __body["trigger_method"] = trigger_method - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -1165,11 +1149,7 @@ def sync_job_update_stats( __body["metadata"] = metadata if total_document_count is not None: __body["total_document_count"] = total_document_count - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1276,11 +1256,7 @@ def update_api_key_id( __body["api_key_id"] = api_key_id if api_key_secret_id is not None: __body["api_key_secret_id"] = api_key_secret_id - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1339,11 +1315,7 @@ def update_configuration( __body["configuration"] = configuration if values is not None: __body["values"] = values - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1402,11 +1374,7 @@ def update_error( if not __body: if error is not None: __body["error"] = error - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1474,11 +1442,7 @@ def update_features( if not __body: if features is not None: __body["features"] = features - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1543,11 +1507,7 @@ def update_filtering( __body["filtering"] = filtering if rules is not None: __body["rules"] = rules - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1604,11 +1564,7 @@ def update_filtering_validation( if not __body: if validation is not None: __body["validation"] = validation - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1665,11 +1621,7 @@ def update_index_name( if not __body: if index_name is not None: __body["index_name"] = index_name - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1727,11 +1679,7 @@ def update_name( __body["description"] = description if name is not None: __body["name"] = name - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1787,11 +1735,7 @@ def update_native( if not __body: if is_native is not None: __body["is_native"] = is_native - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1848,11 +1792,7 @@ def update_pipeline( if not __body: if pipeline is not None: __body["pipeline"] = pipeline - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1908,11 +1848,7 @@ def update_scheduling( if not __body: if scheduling is not None: __body["scheduling"] = scheduling - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1968,11 +1904,7 @@ def update_service_type( if not __body: if service_type is not None: __body["service_type"] = service_type - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2035,11 +1967,7 @@ def update_status( if not __body: if status is not None: __body["status"] = status - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/enrich.py b/elasticsearch/_sync/client/enrich.py index 93a8a3cd2..70374133e 100644 --- a/elasticsearch/_sync/client/enrich.py +++ b/elasticsearch/_sync/client/enrich.py @@ -235,11 +235,7 @@ def put_policy( __body["match"] = match if range is not None: __body["range"] = range - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/eql.py b/elasticsearch/_sync/client/eql.py index 5bf2a22e5..d46716198 100644 --- a/elasticsearch/_sync/client/eql.py +++ b/elasticsearch/_sync/client/eql.py @@ -355,11 +355,7 @@ def search( __body["timestamp_field"] = timestamp_field if wait_for_completion_timeout is not None: __body["wait_for_completion_timeout"] = wait_for_completion_timeout - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/esql.py b/elasticsearch/_sync/client/esql.py index 214868ff8..a700bcd1c 100644 --- a/elasticsearch/_sync/client/esql.py +++ b/elasticsearch/_sync/client/esql.py @@ -194,11 +194,7 @@ def async_query( __body["tables"] = tables if wait_for_completion_timeout is not None: __body["wait_for_completion_timeout"] = wait_for_completion_timeout - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -612,11 +608,7 @@ def query( __body["profile"] = profile if tables is not None: __body["tables"] = tables - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/fleet.py b/elasticsearch/_sync/client/fleet.py index 811294c28..4b36d83c2 100644 --- a/elasticsearch/_sync/client/fleet.py +++ b/elasticsearch/_sync/client/fleet.py @@ -642,11 +642,7 @@ def search( __body["track_total_hits"] = track_total_hits if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/graph.py b/elasticsearch/_sync/client/graph.py index e7ede6586..fc7512530 100644 --- a/elasticsearch/_sync/client/graph.py +++ b/elasticsearch/_sync/client/graph.py @@ -97,11 +97,7 @@ def explore( __body["query"] = query if vertices is not None: __body["vertices"] = vertices - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/ilm.py b/elasticsearch/_sync/client/ilm.py index 33400218e..c845de530 100644 --- a/elasticsearch/_sync/client/ilm.py +++ b/elasticsearch/_sync/client/ilm.py @@ -383,11 +383,7 @@ def move_to_step( __body["current_step"] = current_step if next_step is not None: __body["next_step"] = next_step - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -453,11 +449,7 @@ def put_lifecycle( if not __body: if policy is not None: __body["policy"] = policy - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/indices.py b/elasticsearch/_sync/client/indices.py index 59e062c9c..9bd49afa2 100644 --- a/elasticsearch/_sync/client/indices.py +++ b/elasticsearch/_sync/client/indices.py @@ -232,11 +232,7 @@ def analyze( __body["text"] = text if tokenizer is not None: __body["tokenizer"] = tokenizer - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3273,11 +3269,7 @@ def modify_data_stream( if not __body: if actions is not None: __body["actions"] = actions - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3642,11 +3634,7 @@ def put_data_lifecycle( __body["downsampling"] = downsampling if enabled is not None: __body["enabled"] = enabled - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3725,11 +3713,7 @@ def put_data_stream_options( if not __body: if failure_store is not None: __body["failure_store"] = failure_store - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3970,11 +3954,7 @@ def put_index_template( __body["template"] = template if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4149,11 +4129,7 @@ def put_mapping( __body["runtime"] = runtime if source is not None: __body["_source"] = source - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4422,11 +4398,7 @@ def put_template( __body["settings"] = settings if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -5416,11 +5388,7 @@ def shrink( __body["aliases"] = aliases if settings is not None: __body["settings"] = settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -5772,11 +5740,7 @@ def split( __body["aliases"] = aliases if settings is not None: __body["settings"] = settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -5956,11 +5920,7 @@ def update_aliases( if not __body: if actions is not None: __body["actions"] = actions - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/inference.py b/elasticsearch/_sync/client/inference.py index 2d71f05c1..3434faa1c 100644 --- a/elasticsearch/_sync/client/inference.py +++ b/elasticsearch/_sync/client/inference.py @@ -78,11 +78,7 @@ def completion( __body["input"] = input if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -338,11 +334,7 @@ def inference( __body["query"] = query if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -546,11 +538,7 @@ def put_alibabacloud( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -646,11 +634,7 @@ def put_amazonbedrock( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -752,11 +736,7 @@ def put_amazonsagemaker( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -849,11 +829,7 @@ def put_anthropic( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -945,11 +921,7 @@ def put_azureaistudio( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1049,11 +1021,7 @@ def put_azureopenai( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1143,11 +1111,7 @@ def put_cohere( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1274,11 +1238,7 @@ def put_custom( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1358,11 +1318,7 @@ def put_deepseek( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1470,11 +1426,7 @@ def put_elasticsearch( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1568,11 +1520,7 @@ def put_elser( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1654,11 +1602,7 @@ def put_googleaistudio( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1752,11 +1696,7 @@ def put_googlevertexai( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1884,11 +1824,7 @@ def put_hugging_face( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -1980,11 +1916,7 @@ def put_jinaai( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2066,11 +1998,7 @@ def put_mistral( __body["service_settings"] = service_settings if chunking_settings is not None: __body["chunking_settings"] = chunking_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2164,11 +2092,7 @@ def put_openai( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2259,11 +2183,7 @@ def put_voyageai( __body["chunking_settings"] = chunking_settings if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2343,11 +2263,7 @@ def put_watsonx( __body["service"] = service if service_settings is not None: __body["service_settings"] = service_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -2420,11 +2336,7 @@ def rerank( __body["query"] = query if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2488,11 +2400,7 @@ def sparse_embedding( __body["input"] = input if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2566,11 +2474,7 @@ def text_embedding( __body["input_type"] = input_type if task_settings is not None: __body["task_settings"] = task_settings - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/ingest.py b/elasticsearch/_sync/client/ingest.py index b057117c7..a31cb9cee 100644 --- a/elasticsearch/_sync/client/ingest.py +++ b/elasticsearch/_sync/client/ingest.py @@ -494,11 +494,7 @@ def put_geoip_database( __body["maxmind"] = maxmind if name is not None: __body["name"] = name - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -679,11 +675,7 @@ def put_pipeline( __body["processors"] = processors if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -755,11 +747,7 @@ def simulate( __body["docs"] = docs if pipeline is not None: __body["pipeline"] = pipeline - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/ml.py b/elasticsearch/_sync/client/ml.py index 28e7b8fcc..f519c99ea 100644 --- a/elasticsearch/_sync/client/ml.py +++ b/elasticsearch/_sync/client/ml.py @@ -887,11 +887,7 @@ def estimate_model_memory( __body["max_bucket_cardinality"] = max_bucket_cardinality if overall_cardinality is not None: __body["overall_cardinality"] = overall_cardinality - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -957,11 +953,7 @@ def evaluate_data_frame( __body["index"] = index if query is not None: __body["query"] = query - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2828,11 +2820,7 @@ def infer_trained_model( __body["docs"] = docs if inference_config is not None: __body["inference_config"] = inference_config - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2997,11 +2985,7 @@ def post_calendar_events( if not __body: if events is not None: __body["events"] = events - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3493,11 +3477,7 @@ def put_data_frame_analytics( __body["model_memory_limit"] = model_memory_limit if version is not None: __body["version"] = version - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3709,11 +3689,7 @@ def put_datafeed( __body["script_fields"] = script_fields if scroll_size is not None: __body["scroll_size"] = scroll_size - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3773,11 +3749,7 @@ def put_filter( __body["description"] = description if items is not None: __body["items"] = items - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3997,11 +3969,7 @@ def put_job( __body["results_index_name"] = results_index_name if results_retention_days is not None: __body["results_retention_days"] = results_retention_days - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4135,11 +4103,7 @@ def put_trained_model( __body["prefix_strings"] = prefix_strings if tags is not None: __body["tags"] = tags - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4292,11 +4256,7 @@ def put_trained_model_definition_part( __body["total_definition_length"] = total_definition_length if total_parts is not None: __body["total_parts"] = total_parts - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4361,11 +4321,7 @@ def put_trained_model_vocabulary( __body["merges"] = merges if scores is not None: __body["scores"] = scores - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -5116,11 +5072,7 @@ def update_data_frame_analytics( __body["max_num_threads"] = max_num_threads if model_memory_limit is not None: __body["model_memory_limit"] = model_memory_limit - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5321,11 +5273,7 @@ def update_datafeed( __body["script_fields"] = script_fields if scroll_size is not None: __body["scroll_size"] = scroll_size - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5387,11 +5335,7 @@ def update_filter( __body["description"] = description if remove_items is not None: __body["remove_items"] = remove_items - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5555,11 +5499,7 @@ def update_job( __body["renormalization_window_days"] = renormalization_window_days if results_retention_days is not None: __body["results_retention_days"] = results_retention_days - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5626,11 +5566,7 @@ def update_model_snapshot( __body["description"] = description if retain is not None: __body["retain"] = retain - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -5862,11 +5798,7 @@ def validate( __body["model_snapshot_retention_days"] = model_snapshot_retention_days if results_index_name is not None: __body["results_index_name"] = results_index_name - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/query_rules.py b/elasticsearch/_sync/client/query_rules.py index 054748beb..9d5298da5 100644 --- a/elasticsearch/_sync/client/query_rules.py +++ b/elasticsearch/_sync/client/query_rules.py @@ -350,11 +350,7 @@ def put_rule( __body["type"] = type if priority is not None: __body["priority"] = priority - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -418,11 +414,7 @@ def put_ruleset( if not __body: if rules is not None: __body["rules"] = rules - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -481,11 +473,7 @@ def test( if not __body: if match_criteria is not None: __body["match_criteria"] = match_criteria - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/rollup.py b/elasticsearch/_sync/client/rollup.py index 52a17b3e3..5aef61411 100644 --- a/elasticsearch/_sync/client/rollup.py +++ b/elasticsearch/_sync/client/rollup.py @@ -378,11 +378,7 @@ def put_job( __body["metrics"] = metrics if timeout is not None: __body["timeout"] = timeout - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -474,11 +470,7 @@ def rollup_search( __body["query"] = query if size is not None: __body["size"] = size - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/searchable_snapshots.py b/elasticsearch/_sync/client/searchable_snapshots.py index f9cb03d17..baa48ae6c 100644 --- a/elasticsearch/_sync/client/searchable_snapshots.py +++ b/elasticsearch/_sync/client/searchable_snapshots.py @@ -248,11 +248,7 @@ def mount( __body["index_settings"] = index_settings if renamed_index is not None: __body["renamed_index"] = renamed_index - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/security.py b/elasticsearch/_sync/client/security.py index 6415a5022..80e441c32 100644 --- a/elasticsearch/_sync/client/security.py +++ b/elasticsearch/_sync/client/security.py @@ -94,11 +94,7 @@ def activate_user_profile( __body["password"] = password if username is not None: __body["username"] = username - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -201,11 +197,7 @@ def bulk_delete_role( if not __body: if names is not None: __body["names"] = names - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "DELETE", __path, @@ -266,11 +258,7 @@ def bulk_put_role( if not __body: if roles is not None: __body["roles"] = roles - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -354,11 +342,7 @@ def bulk_update_api_keys( __body["metadata"] = metadata if role_descriptors is not None: __body["role_descriptors"] = role_descriptors - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -432,11 +416,7 @@ def change_password( __body["password"] = password if password_hash is not None: __body["password_hash"] = password_hash - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -783,11 +763,7 @@ def create_api_key( __body["name"] = name if role_descriptors is not None: __body["role_descriptors"] = role_descriptors - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -869,11 +845,7 @@ def create_cross_cluster_api_key( __body["expiration"] = expiration if metadata is not None: __body["metadata"] = metadata - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -1022,11 +994,7 @@ def delegate_pki( if not __body: if x509_certificate_chain is not None: __body["x509_certificate_chain"] = x509_certificate_chain - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2176,11 +2144,7 @@ def get_token( __body["scope"] = scope if username is not None: __body["username"] = username - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2444,11 +2408,7 @@ def grant_api_key( __body["run_as"] = run_as if username is not None: __body["username"] = username - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2584,11 +2544,7 @@ def has_privileges( __body["cluster"] = cluster if index is not None: __body["index"] = index - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2649,11 +2605,7 @@ def has_privileges_user_profile( __body["privileges"] = privileges if uids is not None: __body["uids"] = uids - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2742,11 +2694,7 @@ def invalidate_api_key( __body["realm_name"] = realm_name if username is not None: __body["username"] = username - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "DELETE", __path, @@ -2820,11 +2768,7 @@ def invalidate_token( __body["token"] = token if username is not None: __body["username"] = username - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "DELETE", __path, @@ -2905,11 +2849,7 @@ def oidc_authenticate( __body["state"] = state if realm is not None: __body["realm"] = realm - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -2968,11 +2908,7 @@ def oidc_logout( __body["token"] = token if refresh_token is not None: __body["refresh_token"] = refresh_token - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3055,11 +2991,7 @@ def oidc_prepare_authentication( __body["realm"] = realm if state is not None: __body["state"] = state - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -3336,11 +3268,7 @@ def put_role( __body["run_as"] = run_as if transient_metadata is not None: __body["transient_metadata"] = transient_metadata - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3454,11 +3382,7 @@ def put_role_mapping( __body["rules"] = rules if run_as is not None: __body["run_as"] = run_as - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3568,11 +3492,7 @@ def put_user( __body["password_hash"] = password_hash if roles is not None: __body["roles"] = roles - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -3995,11 +3915,7 @@ def saml_authenticate( __body["ids"] = ids if realm is not None: __body["realm"] = realm - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4077,11 +3993,7 @@ def saml_complete_logout( __body["content"] = content if query_string is not None: __body["query_string"] = query_string - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4159,11 +4071,7 @@ def saml_invalidate( __body["acs"] = acs if realm is not None: __body["realm"] = realm - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4227,11 +4135,7 @@ def saml_logout( __body["token"] = token if refresh_token is not None: __body["refresh_token"] = refresh_token - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4304,11 +4208,7 @@ def saml_prepare_authentication( __body["realm"] = realm if relay_state is not None: __body["relay_state"] = relay_state - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -4604,11 +4504,7 @@ def update_cross_cluster_api_key( __body["expiration"] = expiration if metadata is not None: __body["metadata"] = metadata - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4685,11 +4581,7 @@ def update_settings( __body["security-profile"] = security_profile if security_tokens is not None: __body["security-tokens"] = security_tokens - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -4783,11 +4675,7 @@ def update_user_profile_data( __body["data"] = data if labels is not None: __body["labels"] = labels - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/shutdown.py b/elasticsearch/_sync/client/shutdown.py index 109b0c20b..fc3e30cf2 100644 --- a/elasticsearch/_sync/client/shutdown.py +++ b/elasticsearch/_sync/client/shutdown.py @@ -251,11 +251,7 @@ def put_node( __body["allocation_delay"] = allocation_delay if target_node_name is not None: __body["target_node_name"] = target_node_name - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/simulate.py b/elasticsearch/_sync/client/simulate.py index 9b99da41a..6ce875584 100644 --- a/elasticsearch/_sync/client/simulate.py +++ b/elasticsearch/_sync/client/simulate.py @@ -133,11 +133,7 @@ def ingest( __body["mapping_addition"] = mapping_addition if pipeline_substitutions is not None: __body["pipeline_substitutions"] = pipeline_substitutions - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/slm.py b/elasticsearch/_sync/client/slm.py index e8f267bbe..e4e270b2f 100644 --- a/elasticsearch/_sync/client/slm.py +++ b/elasticsearch/_sync/client/slm.py @@ -431,11 +431,7 @@ def put_lifecycle( __body["retention"] = retention if schedule is not None: __body["schedule"] = schedule - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/snapshot.py b/elasticsearch/_sync/client/snapshot.py index e4073474a..faf8e3181 100644 --- a/elasticsearch/_sync/client/snapshot.py +++ b/elasticsearch/_sync/client/snapshot.py @@ -155,11 +155,7 @@ def clone( if not __body: if indices is not None: __body["indices"] = indices - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/sql.py b/elasticsearch/_sync/client/sql.py index 8191845b9..b14eef35c 100644 --- a/elasticsearch/_sync/client/sql.py +++ b/elasticsearch/_sync/client/sql.py @@ -65,11 +65,7 @@ def clear_cursor( if not __body: if cursor is not None: __body["cursor"] = cursor - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -396,11 +392,7 @@ def query( __body["time_zone"] = time_zone if wait_for_completion_timeout is not None: __body["wait_for_completion_timeout"] = wait_for_completion_timeout - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -465,11 +457,7 @@ def translate( __body["filter"] = filter if time_zone is not None: __body["time_zone"] = time_zone - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/synonyms.py b/elasticsearch/_sync/client/synonyms.py index 6806a091f..b0199685f 100644 --- a/elasticsearch/_sync/client/synonyms.py +++ b/elasticsearch/_sync/client/synonyms.py @@ -348,11 +348,7 @@ def put_synonym( if not __body: if synonyms_set is not None: __body["synonyms_set"] = synonyms_set - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -424,11 +420,7 @@ def put_synonym_rule( if not __body: if synonyms is not None: __body["synonyms"] = synonyms - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_sync/client/text_structure.py b/elasticsearch/_sync/client/text_structure.py index 4cb51ddf3..5a64961c7 100644 --- a/elasticsearch/_sync/client/text_structure.py +++ b/elasticsearch/_sync/client/text_structure.py @@ -378,11 +378,7 @@ def find_message_structure( if not __body: if messages is not None: __body["messages"] = messages - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, @@ -660,11 +656,7 @@ def test_grok_pattern( __body["grok_pattern"] = grok_pattern if text is not None: __body["text"] = text - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/transform.py b/elasticsearch/_sync/client/transform.py index e5f22ef90..2ed2652da 100644 --- a/elasticsearch/_sync/client/transform.py +++ b/elasticsearch/_sync/client/transform.py @@ -520,11 +520,7 @@ def put_transform( __body["settings"] = settings if sync is not None: __body["sync"] = sync - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -954,11 +950,7 @@ def update_transform( __body["source"] = source if sync is not None: __body["sync"] = sync - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "POST", __path, diff --git a/elasticsearch/_sync/client/watcher.py b/elasticsearch/_sync/client/watcher.py index 9d511dbee..73f5eecb2 100644 --- a/elasticsearch/_sync/client/watcher.py +++ b/elasticsearch/_sync/client/watcher.py @@ -552,11 +552,7 @@ def put_watch( __body["transform"] = transform if trigger is not None: __body["trigger"] = trigger - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, @@ -884,11 +880,7 @@ def update_settings( __body["index.auto_expand_replicas"] = index_auto_expand_replicas if index_number_of_replicas is not None: __body["index.number_of_replicas"] = index_number_of_replicas - if not __body: - __body = None # type: ignore[assignment] - __headers = {"accept": "application/json"} - if __body is not None: - __headers["content-type"] = "application/json" + __headers = {"accept": "application/json", "content-type": "application/json"} return self.perform_request( # type: ignore[return-value] "PUT", __path, diff --git a/elasticsearch/_version.py b/elasticsearch/_version.py index 77379079c..e926f8270 100644 --- a/elasticsearch/_version.py +++ b/elasticsearch/_version.py @@ -16,4 +16,4 @@ # under the License. __versionstr__ = "9.1.2" -__es_specification_commit__ = "55018ddf7f2a1a5ba3ed62863d9d28bd155b05e6" +__es_specification_commit__ = "69144c05ec6727c4ee39aec454f7ad6a57d240fc"