From a2ee3a8987725e76103b540f4e0444f8d0565a90 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 7 Feb 2024 14:05:41 +0400 Subject: [PATCH 1/2] Switch to 2024 black style --- elasticsearch/_async/client/__init__.py | 6 +-- elasticsearch/_async/client/_base.py | 6 +-- elasticsearch/_async/client/ccr.py | 60 ++++++++++++------------- elasticsearch/_async/client/ml.py | 12 ++--- elasticsearch/_sync/client/__init__.py | 6 +-- elasticsearch/_sync/client/_base.py | 6 +-- elasticsearch/_sync/client/ccr.py | 60 ++++++++++++------------- elasticsearch/_sync/client/ml.py | 12 ++--- noxfile.py | 2 +- 9 files changed, 85 insertions(+), 85 deletions(-) diff --git a/elasticsearch/_async/client/__init__.py b/elasticsearch/_async/client/__init__.py index 7b46bd35e..0324d4fbe 100644 --- a/elasticsearch/_async/client/__init__.py +++ b/elasticsearch/_async/client/__init__.py @@ -392,9 +392,9 @@ def __init__( if sniff_timeout is not DEFAULT: transport_kwargs["sniff_timeout"] = sniff_timeout if min_delay_between_sniffing is not DEFAULT: - transport_kwargs[ - "min_delay_between_sniffing" - ] = min_delay_between_sniffing + transport_kwargs["min_delay_between_sniffing"] = ( + min_delay_between_sniffing + ) _transport = transport_class( node_configs, diff --git a/elasticsearch/_async/client/_base.py b/elasticsearch/_async/client/_base.py index ea969b68e..ddd622e25 100644 --- a/elasticsearch/_async/client/_base.py +++ b/elasticsearch/_async/client/_base.py @@ -126,9 +126,9 @@ def resolve_auth_headers( if resolved_api_key: headers["authorization"] = f"ApiKey {_base64_auth_header(resolved_api_key)}" if resolved_basic_auth: - headers[ - "authorization" - ] = f"Basic {_base64_auth_header(resolved_basic_auth)}" + headers["authorization"] = ( + f"Basic {_base64_auth_header(resolved_basic_auth)}" + ) if resolved_bearer_auth: headers["authorization"] = f"Bearer {resolved_bearer_auth}" diff --git a/elasticsearch/_async/client/ccr.py b/elasticsearch/_async/client/ccr.py index 9dbb550bf..33e121a4c 100644 --- a/elasticsearch/_async/client/ccr.py +++ b/elasticsearch/_async/client/ccr.py @@ -147,13 +147,13 @@ async def follow( if max_outstanding_read_requests is not None: __body["max_outstanding_read_requests"] = max_outstanding_read_requests if max_outstanding_write_requests is not None: - __body[ - "max_outstanding_write_requests" - ] = max_outstanding_write_requests + __body["max_outstanding_write_requests"] = ( + max_outstanding_write_requests + ) if max_read_request_operation_count is not None: - __body[ - "max_read_request_operation_count" - ] = max_read_request_operation_count + __body["max_read_request_operation_count"] = ( + max_read_request_operation_count + ) if max_read_request_size is not None: __body["max_read_request_size"] = max_read_request_size if max_retry_delay is not None: @@ -163,9 +163,9 @@ async def follow( if max_write_buffer_size is not None: __body["max_write_buffer_size"] = max_write_buffer_size if max_write_request_operation_count is not None: - __body[ - "max_write_request_operation_count" - ] = max_write_request_operation_count + __body["max_write_request_operation_count"] = ( + max_write_request_operation_count + ) if max_write_request_size is not None: __body["max_write_request_size"] = max_write_request_size if read_poll_timeout is not None: @@ -537,21 +537,21 @@ async def put_auto_follow_pattern( if follow_index_pattern is not None: __body["follow_index_pattern"] = follow_index_pattern if leader_index_exclusion_patterns is not None: - __body[ - "leader_index_exclusion_patterns" - ] = leader_index_exclusion_patterns + __body["leader_index_exclusion_patterns"] = ( + leader_index_exclusion_patterns + ) if leader_index_patterns is not None: __body["leader_index_patterns"] = leader_index_patterns if max_outstanding_read_requests is not None: __body["max_outstanding_read_requests"] = max_outstanding_read_requests if max_outstanding_write_requests is not None: - __body[ - "max_outstanding_write_requests" - ] = max_outstanding_write_requests + __body["max_outstanding_write_requests"] = ( + max_outstanding_write_requests + ) if max_read_request_operation_count is not None: - __body[ - "max_read_request_operation_count" - ] = max_read_request_operation_count + __body["max_read_request_operation_count"] = ( + max_read_request_operation_count + ) if max_read_request_size is not None: __body["max_read_request_size"] = max_read_request_size if max_retry_delay is not None: @@ -561,9 +561,9 @@ async def put_auto_follow_pattern( if max_write_buffer_size is not None: __body["max_write_buffer_size"] = max_write_buffer_size if max_write_request_operation_count is not None: - __body[ - "max_write_request_operation_count" - ] = max_write_request_operation_count + __body["max_write_request_operation_count"] = ( + max_write_request_operation_count + ) if max_write_request_size is not None: __body["max_write_request_size"] = max_write_request_size if read_poll_timeout is not None: @@ -682,13 +682,13 @@ async def resume_follow( if max_outstanding_read_requests is not None: __body["max_outstanding_read_requests"] = max_outstanding_read_requests if max_outstanding_write_requests is not None: - __body[ - "max_outstanding_write_requests" - ] = max_outstanding_write_requests + __body["max_outstanding_write_requests"] = ( + max_outstanding_write_requests + ) if max_read_request_operation_count is not None: - __body[ - "max_read_request_operation_count" - ] = max_read_request_operation_count + __body["max_read_request_operation_count"] = ( + max_read_request_operation_count + ) if max_read_request_size is not None: __body["max_read_request_size"] = max_read_request_size if max_retry_delay is not None: @@ -698,9 +698,9 @@ async def resume_follow( if max_write_buffer_size is not None: __body["max_write_buffer_size"] = max_write_buffer_size if max_write_request_operation_count is not None: - __body[ - "max_write_request_operation_count" - ] = max_write_request_operation_count + __body["max_write_request_operation_count"] = ( + max_write_request_operation_count + ) if max_write_request_size is not None: __body["max_write_request_size"] = max_write_request_size if read_poll_timeout is not None: diff --git a/elasticsearch/_async/client/ml.py b/elasticsearch/_async/client/ml.py index 42fcaf374..5b937222d 100644 --- a/elasticsearch/_async/client/ml.py +++ b/elasticsearch/_async/client/ml.py @@ -3189,9 +3189,9 @@ async def put_job( if custom_settings is not None: __body["custom_settings"] = custom_settings if daily_model_snapshot_retention_after_days is not None: - __body[ - "daily_model_snapshot_retention_after_days" - ] = daily_model_snapshot_retention_after_days + __body["daily_model_snapshot_retention_after_days"] = ( + daily_model_snapshot_retention_after_days + ) if datafeed_config is not None: __body["datafeed_config"] = datafeed_config if description is not None: @@ -4420,9 +4420,9 @@ async def update_job( if custom_settings is not None: __body["custom_settings"] = custom_settings if daily_model_snapshot_retention_after_days is not None: - __body[ - "daily_model_snapshot_retention_after_days" - ] = daily_model_snapshot_retention_after_days + __body["daily_model_snapshot_retention_after_days"] = ( + daily_model_snapshot_retention_after_days + ) if description is not None: __body["description"] = description if detectors is not None: diff --git a/elasticsearch/_sync/client/__init__.py b/elasticsearch/_sync/client/__init__.py index 606d044df..7d595dacf 100644 --- a/elasticsearch/_sync/client/__init__.py +++ b/elasticsearch/_sync/client/__init__.py @@ -392,9 +392,9 @@ def __init__( if sniff_timeout is not DEFAULT: transport_kwargs["sniff_timeout"] = sniff_timeout if min_delay_between_sniffing is not DEFAULT: - transport_kwargs[ - "min_delay_between_sniffing" - ] = min_delay_between_sniffing + transport_kwargs["min_delay_between_sniffing"] = ( + min_delay_between_sniffing + ) _transport = transport_class( node_configs, diff --git a/elasticsearch/_sync/client/_base.py b/elasticsearch/_sync/client/_base.py index 934ae47d7..ea08f7f62 100644 --- a/elasticsearch/_sync/client/_base.py +++ b/elasticsearch/_sync/client/_base.py @@ -126,9 +126,9 @@ def resolve_auth_headers( if resolved_api_key: headers["authorization"] = f"ApiKey {_base64_auth_header(resolved_api_key)}" if resolved_basic_auth: - headers[ - "authorization" - ] = f"Basic {_base64_auth_header(resolved_basic_auth)}" + headers["authorization"] = ( + f"Basic {_base64_auth_header(resolved_basic_auth)}" + ) if resolved_bearer_auth: headers["authorization"] = f"Bearer {resolved_bearer_auth}" diff --git a/elasticsearch/_sync/client/ccr.py b/elasticsearch/_sync/client/ccr.py index ca16c3302..8cd218d44 100644 --- a/elasticsearch/_sync/client/ccr.py +++ b/elasticsearch/_sync/client/ccr.py @@ -147,13 +147,13 @@ def follow( if max_outstanding_read_requests is not None: __body["max_outstanding_read_requests"] = max_outstanding_read_requests if max_outstanding_write_requests is not None: - __body[ - "max_outstanding_write_requests" - ] = max_outstanding_write_requests + __body["max_outstanding_write_requests"] = ( + max_outstanding_write_requests + ) if max_read_request_operation_count is not None: - __body[ - "max_read_request_operation_count" - ] = max_read_request_operation_count + __body["max_read_request_operation_count"] = ( + max_read_request_operation_count + ) if max_read_request_size is not None: __body["max_read_request_size"] = max_read_request_size if max_retry_delay is not None: @@ -163,9 +163,9 @@ def follow( if max_write_buffer_size is not None: __body["max_write_buffer_size"] = max_write_buffer_size if max_write_request_operation_count is not None: - __body[ - "max_write_request_operation_count" - ] = max_write_request_operation_count + __body["max_write_request_operation_count"] = ( + max_write_request_operation_count + ) if max_write_request_size is not None: __body["max_write_request_size"] = max_write_request_size if read_poll_timeout is not None: @@ -537,21 +537,21 @@ def put_auto_follow_pattern( if follow_index_pattern is not None: __body["follow_index_pattern"] = follow_index_pattern if leader_index_exclusion_patterns is not None: - __body[ - "leader_index_exclusion_patterns" - ] = leader_index_exclusion_patterns + __body["leader_index_exclusion_patterns"] = ( + leader_index_exclusion_patterns + ) if leader_index_patterns is not None: __body["leader_index_patterns"] = leader_index_patterns if max_outstanding_read_requests is not None: __body["max_outstanding_read_requests"] = max_outstanding_read_requests if max_outstanding_write_requests is not None: - __body[ - "max_outstanding_write_requests" - ] = max_outstanding_write_requests + __body["max_outstanding_write_requests"] = ( + max_outstanding_write_requests + ) if max_read_request_operation_count is not None: - __body[ - "max_read_request_operation_count" - ] = max_read_request_operation_count + __body["max_read_request_operation_count"] = ( + max_read_request_operation_count + ) if max_read_request_size is not None: __body["max_read_request_size"] = max_read_request_size if max_retry_delay is not None: @@ -561,9 +561,9 @@ def put_auto_follow_pattern( if max_write_buffer_size is not None: __body["max_write_buffer_size"] = max_write_buffer_size if max_write_request_operation_count is not None: - __body[ - "max_write_request_operation_count" - ] = max_write_request_operation_count + __body["max_write_request_operation_count"] = ( + max_write_request_operation_count + ) if max_write_request_size is not None: __body["max_write_request_size"] = max_write_request_size if read_poll_timeout is not None: @@ -682,13 +682,13 @@ def resume_follow( if max_outstanding_read_requests is not None: __body["max_outstanding_read_requests"] = max_outstanding_read_requests if max_outstanding_write_requests is not None: - __body[ - "max_outstanding_write_requests" - ] = max_outstanding_write_requests + __body["max_outstanding_write_requests"] = ( + max_outstanding_write_requests + ) if max_read_request_operation_count is not None: - __body[ - "max_read_request_operation_count" - ] = max_read_request_operation_count + __body["max_read_request_operation_count"] = ( + max_read_request_operation_count + ) if max_read_request_size is not None: __body["max_read_request_size"] = max_read_request_size if max_retry_delay is not None: @@ -698,9 +698,9 @@ def resume_follow( if max_write_buffer_size is not None: __body["max_write_buffer_size"] = max_write_buffer_size if max_write_request_operation_count is not None: - __body[ - "max_write_request_operation_count" - ] = max_write_request_operation_count + __body["max_write_request_operation_count"] = ( + max_write_request_operation_count + ) if max_write_request_size is not None: __body["max_write_request_size"] = max_write_request_size if read_poll_timeout is not None: diff --git a/elasticsearch/_sync/client/ml.py b/elasticsearch/_sync/client/ml.py index 471e931f8..fe9821b87 100644 --- a/elasticsearch/_sync/client/ml.py +++ b/elasticsearch/_sync/client/ml.py @@ -3189,9 +3189,9 @@ def put_job( if custom_settings is not None: __body["custom_settings"] = custom_settings if daily_model_snapshot_retention_after_days is not None: - __body[ - "daily_model_snapshot_retention_after_days" - ] = daily_model_snapshot_retention_after_days + __body["daily_model_snapshot_retention_after_days"] = ( + daily_model_snapshot_retention_after_days + ) if datafeed_config is not None: __body["datafeed_config"] = datafeed_config if description is not None: @@ -4420,9 +4420,9 @@ def update_job( if custom_settings is not None: __body["custom_settings"] = custom_settings if daily_model_snapshot_retention_after_days is not None: - __body[ - "daily_model_snapshot_retention_after_days" - ] = daily_model_snapshot_retention_after_days + __body["daily_model_snapshot_retention_after_days"] = ( + daily_model_snapshot_retention_after_days + ) if description is not None: __body["description"] = description if detectors is not None: diff --git a/noxfile.py b/noxfile.py index f2f4ebe28..e19e8395c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -53,7 +53,7 @@ def test(session): @nox.session() def format(session): - session.install("black", "isort", "flynt", "unasync") + session.install("black", "isort", "flynt", "unasync", "setuptools") session.run("python", "utils/run-unasync.py") session.run("isort", "--profile=black", *SOURCE_FILES) From 37ea62ed13756542c165aafe93e1123635ba9cbd Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 7 Feb 2024 14:39:56 +0400 Subject: [PATCH 2/2] Ask for black 24.x specifically --- noxfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/noxfile.py b/noxfile.py index e19e8395c..10a57815a 100644 --- a/noxfile.py +++ b/noxfile.py @@ -53,7 +53,7 @@ def test(session): @nox.session() def format(session): - session.install("black", "isort", "flynt", "unasync", "setuptools") + session.install("black~=24.0", "isort", "flynt", "unasync", "setuptools") session.run("python", "utils/run-unasync.py") session.run("isort", "--profile=black", *SOURCE_FILES) @@ -66,7 +66,7 @@ def format(session): @nox.session() def lint(session): - session.install("flake8", "black", "mypy", "isort", "types-requests") + session.install("flake8", "black~=24.0", "mypy", "isort", "types-requests") session.run("isort", "--check", "--profile=black", *SOURCE_FILES) session.run("black", "--check", *SOURCE_FILES)