You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2022/01/31 11:03:38 UTC

[airflow] branch v2-2-test updated: Actually fix tuple and bool checks for black 22.1.0 (#21221)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch v2-2-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v2-2-test by this push:
     new c447751  Actually fix tuple and bool checks for black 22.1.0 (#21221)
c447751 is described below

commit c4477512eba6a7f27f63de7e8a24f8bc0e4e2874
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sun Jan 30 16:59:36 2022 +0100

    Actually fix tuple and bool checks for black 22.1.0 (#21221)
    
    Previous two fixes in #21215 and #21216 did not really fix the
    problem introduced by Black 22.1.0 (they could not as they were
    wrong). This change was actually tested with the new black and
    should fix it finally.
    
    (cherry picked from commit f9e20067e0ac593fd18ad068fcc56501c6a99f2b)
---
 dev/provider_packages/prepare_provider_packages.py | 23 +++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/dev/provider_packages/prepare_provider_packages.py b/dev/provider_packages/prepare_provider_packages.py
index 7d0e1e5..8d920d6 100755
--- a/dev/provider_packages/prepare_provider_packages.py
+++ b/dev/provider_packages/prepare_provider_packages.py
@@ -1334,9 +1334,14 @@ def get_all_changes_for_package(
                         )
                         # Returns 66 in case of doc-only changes
                         sys.exit(66)
+                    if len(changes) > len(changes_since_last_doc_only_check):
+                        # if doc-only was released after previous release - use it as starting point
+                        # but if before - stay with the releases from last tag.
+                        changes = changes_since_last_doc_only_check
                 except subprocess.CalledProcessError:
                     # ignore when the commit mentioned as last doc-only change is obsolete
                     pass
+
             console.print(f"[yellow]The provider {provider_package_id} has changes since last release[/]")
             console.print()
             console.print(
@@ -1697,16 +1702,16 @@ def black_mode():
     config = parse_pyproject_toml(os.path.join(SOURCE_DIR_PATH, "pyproject.toml"))
 
     target_versions = set(
-        target_version_option_callback(None, None, config.get('target_version', [])),
+        target_version_option_callback(None, None, tuple(config.get('target_version', ()))),
     )
 
     return Mode(
         target_versions=target_versions,
         line_length=config.get('line_length', Mode.line_length),
-        is_pyi=config.get('is_pyi', Mode.is_pyi),
-        string_normalization=not config.get('skip_string_normalization', not Mode.string_normalization),
-        experimental_string_processing=config.get(
-            'experimental_string_processing', Mode.experimental_string_processing
+        is_pyi=bool(config.get('is_pyi', Mode.is_pyi)),
+        string_normalization=not bool(config.get('skip_string_normalization', not Mode.string_normalization)),
+        experimental_string_processing=bool(
+            config.get('experimental_string_processing', Mode.experimental_string_processing)
         ),
     )
 
@@ -2180,6 +2185,14 @@ KNOWN_DEPRECATED_DIRECT_IMPORTS: Set[str] = {
     'This module is deprecated. Please use `airflow.providers.amazon.aws.operators.sagemaker`.',
     'This module is deprecated. Please use `airflow.providers.amazon.aws.sensors.sagemaker`.',
     'This module is deprecated. Please use `airflow.providers.amazon.aws.hooks.emr`.',
+    'This module is deprecated. Please use `airflow.providers.opsgenie.hooks.opsgenie`.',
+    'This module is deprecated. Please use `airflow.providers.opsgenie.operators.opsgenie`.',
+    'This module is deprecated. Please use `airflow.hooks.redshift_sql` '
+    'or `airflow.hooks.redshift_cluster` as appropriate.',
+    'This module is deprecated. Please use `airflow.providers.amazon.aws.operators.redshift_sql` or '
+    '`airflow.providers.amazon.aws.operators.redshift_cluster` as appropriate.',
+    'This module is deprecated. Please use `airflow.providers.amazon.aws.sensors.redshift_cluster`.',
+    "This module is deprecated. Please use airflow.providers.amazon.aws.transfers.sql_to_s3`.",
 }