Skip to content

Commit

Permalink
Actually fix tuple and bool checks for black 22.1.0 (#21221)
Browse files Browse the repository at this point in the history
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 f9e2006)
  • Loading branch information
potiuk authored and jedcunningham committed Feb 10, 2022
1 parent 30b0d98 commit 4852b81
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions dev/provider_packages/prepare_provider_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
),
)

Expand Down Expand Up @@ -2180,6 +2185,14 @@ def summarise_total_vs_bad_and_warnings(total: int, bad: int, warns: List[warnin
'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`.",
}


Expand Down

0 comments on commit 4852b81

Please sign in to comment.