This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 837e0fe2ea Update pre-commit hooks (#28567)
837e0fe2ea is described below
commit 837e0fe2ea8859ae879d8382142c29a6416f02b9
Author: KarshVashi <[email protected]>
AuthorDate: Sat Dec 24 01:03:59 2022 +0000
Update pre-commit hooks (#28567)
---
.pre-commit-config.yaml | 8 ++++----
airflow/www/fab_security/manager.py | 2 +-
.../src/airflow_breeze/commands/testing_commands.py | 2 +-
dev/provider_packages/prepare_provider_packages.py | 16 ++++++++--------
docs/exts/docs_build/docs_builder.py | 4 ++--
docs/exts/extra_files_with_substitutions.py | 2 +-
docs/exts/extra_provider_files_with_substitutions.py | 2 +-
docs/exts/provider_init_hack.py | 2 +-
kubernetes_tests/test_base.py | 2 +-
tests/jobs/test_triggerer_job.py | 2 +-
10 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index e6e084bb5c..cc40fd856d 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -163,7 +163,7 @@ repos:
name: Run isort to sort imports in Python files
# Keep version of black in sync wit blacken-docs, pre-commit-hook-names,
update-common-sql-api-stubs
- repo: https://github.com/psf/black
- rev: 22.3.0
+ rev: 22.12.0
hooks:
- id: black
name: Run black (python formatter)
@@ -225,7 +225,7 @@ repos:
pass_filenames: true
# TODO: Bump to Python 3.8 when support for Python 3.7 is dropped in Airflow.
- repo: https://github.com/asottile/pyupgrade
- rev: v2.32.1
+ rev: v3.3.1
hooks:
- id: pyupgrade
name: Upgrade Python code automatically
@@ -269,7 +269,7 @@ repos:
^airflow/_vendor/
additional_dependencies: ['toml']
- repo: https://github.com/asottile/yesqa
- rev: v1.3.0
+ rev: v1.4.0
hooks:
- id: yesqa
name: Remove unnecessary noqa statements
@@ -278,7 +278,7 @@ repos:
^airflow/_vendor/
additional_dependencies: ['flake8>=4.0.1']
- repo: https://github.com/ikamensh/flynt
- rev: '0.76'
+ rev: '0.77'
hooks:
- id: flynt
name: Run flynt string format converter for Python
diff --git a/airflow/www/fab_security/manager.py
b/airflow/www/fab_security/manager.py
index 96649b046b..ea8918053c 100644
--- a/airflow/www/fab_security/manager.py
+++ b/airflow/www/fab_security/manager.py
@@ -1013,7 +1013,7 @@ class BaseSecurityManager:
@staticmethod
def ldap_extract(ldap_dict: dict[str, list[bytes]], field_name: str,
fallback: str) -> str:
- raw_value = ldap_dict.get(field_name, [bytes()])
+ raw_value = ldap_dict.get(field_name, [b""])
# decode - if empty string, default to fallback, otherwise take first
element
return raw_value[0].decode("utf-8") or fallback
diff --git a/dev/breeze/src/airflow_breeze/commands/testing_commands.py
b/dev/breeze/src/airflow_breeze/commands/testing_commands.py
index 99e87dcab8..1dcfa1196d 100644
--- a/dev/breeze/src/airflow_breeze/commands/testing_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/testing_commands.py
@@ -177,7 +177,7 @@ def _run_test(
for container_id in container_ids:
dump_path = FILES_DIR /
f"container_logs_{container_id}_{date_str}.log"
get_console(output=output).print(f"[info]Dumping container
{container_id} to {dump_path}")
- with open(dump_path, "wt") as outfile:
+ with open(dump_path, "w") as outfile:
run_command(["docker", "logs", container_id], check=False,
stdout=outfile)
finally:
run_command(
diff --git a/dev/provider_packages/prepare_provider_packages.py
b/dev/provider_packages/prepare_provider_packages.py
index e642c41349..f892c82774 100755
--- a/dev/provider_packages/prepare_provider_packages.py
+++ b/dev/provider_packages/prepare_provider_packages.py
@@ -1108,7 +1108,7 @@ def prepare_readme_file(context):
template_name="PROVIDER_README", context=context, extension=".rst"
)
readme_file_path = os.path.join(TARGET_PROVIDER_PACKAGES_PATH,
"README.rst")
- with open(readme_file_path, "wt") as readme_file:
+ with open(readme_file_path, "w") as readme_file:
readme_file.write(readme_content)
@@ -1180,7 +1180,7 @@ def
mark_latest_changes_as_documentation_only(provider_package_id: str, latest_c
"as doc-only changes!"
)
with open(
- os.path.join(provider_details.source_provider_package_path,
".latest-doc-only-change.txt"), "tw"
+ os.path.join(provider_details.source_provider_package_path,
".latest-doc-only-change.txt"), "w"
) as f:
f.write(latest_change.full_hash + "\n")
# exit code 66 marks doc-only change marked
@@ -1309,7 +1309,7 @@ def replace_content(file_path, old_text, new_text,
provider_package_id):
try:
if os.path.isfile(file_path):
copyfile(file_path, temp_file_path)
- with open(file_path, "wt") as readme_file:
+ with open(file_path, "w") as readme_file:
readme_file.write(new_text)
console.print()
console.print(f"Generated {file_path} file for the
{provider_package_id} provider")
@@ -1399,7 +1399,7 @@ def prepare_setup_py_file(context):
setup_py_content = render_template(
template_name=setup_py_template_name, context=context,
extension=".py", autoescape=False
)
- with open(setup_py_file_path, "wt") as setup_py_file:
+ with open(setup_py_file_path, "w") as setup_py_file:
setup_py_file.write(black_format(setup_py_content))
@@ -1413,7 +1413,7 @@ def prepare_setup_cfg_file(context):
autoescape=False,
keep_trailing_newline=True,
)
- with open(setup_cfg_file_path, "wt") as setup_cfg_file:
+ with open(setup_cfg_file_path, "w") as setup_cfg_file:
setup_cfg_file.write(setup_cfg_content)
@@ -1432,7 +1432,7 @@ def prepare_get_provider_info_py_file(context,
provider_package_id: str):
autoescape=False,
keep_trailing_newline=True,
)
- with open(get_provider_file_path, "wt") as get_provider_file:
+ with open(get_provider_file_path, "w") as get_provider_file:
get_provider_file.write(black_format(get_provider_content))
@@ -1445,7 +1445,7 @@ def prepare_manifest_in_file(context):
autoescape=False,
keep_trailing_newline=True,
)
- with open(target, "wt") as fh:
+ with open(target, "w") as fh:
fh.write(content)
@@ -1838,7 +1838,7 @@ def generate_new_changelog(package_id, provider_details,
changelog_path, changes
console.print(
f"[green]Appending the provider {package_id} changelog for
`{latest_version}` version.[/]"
)
- with open(changelog_path, "wt") as changelog:
+ with open(changelog_path, "w") as changelog:
changelog.write("\n".join(new_changelog_lines))
changelog.write("\n")
diff --git a/docs/exts/docs_build/docs_builder.py
b/docs/exts/docs_build/docs_builder.py
index d6b01d7239..90baffe2ba 100644
--- a/docs/exts/docs_build/docs_builder.py
+++ b/docs/exts/docs_build/docs_builder.py
@@ -162,7 +162,7 @@ class AirflowDocsBuilder:
" ".join(shlex.quote(c) for c in build_cmd),
)
console.print(f"[info]{self.package_name:60}:[/] The output is
hidden until an error occurs.")
- with open(self.log_spelling_filename, "wt") as output:
+ with open(self.log_spelling_filename, "w") as output:
completed_proc = run(
build_cmd,
cwd=self._src_dir,
@@ -241,7 +241,7 @@ class AirflowDocsBuilder:
f"[info]{self.package_name:60}:[/] Running sphinx. "
f"The output is hidden until an error occurs."
)
- with open(self.log_build_filename, "wt") as output:
+ with open(self.log_build_filename, "w") as output:
completed_proc = run(
build_cmd,
cwd=self._src_dir,
diff --git a/docs/exts/extra_files_with_substitutions.py
b/docs/exts/extra_files_with_substitutions.py
index 18be115a57..cb91b163f0 100644
--- a/docs/exts/extra_files_with_substitutions.py
+++ b/docs/exts/extra_files_with_substitutions.py
@@ -38,7 +38,7 @@ def copy_docker_compose(app, exception):
with open(os.path.join(app.outdir, os.path.dirname(path),
os.path.basename(path))) as input_file:
content = input_file.readlines()
with open(
- os.path.join(app.outdir, os.path.dirname(path),
os.path.basename(path)), "wt"
+ os.path.join(app.outdir, os.path.dirname(path),
os.path.basename(path)), "w"
) as output_file:
for line in content:
output_file.write(line.replace("|version|",
app.config.version))
diff --git a/docs/exts/extra_provider_files_with_substitutions.py
b/docs/exts/extra_provider_files_with_substitutions.py
index c35fad15be..2ccd3cf935 100644
--- a/docs/exts/extra_provider_files_with_substitutions.py
+++ b/docs/exts/extra_provider_files_with_substitutions.py
@@ -32,7 +32,7 @@ def fix_provider_references(app, exception):
continue
with open(path) as input_file:
content = input_file.readlines()
- with open(path, "wt") as output_file:
+ with open(path, "w") as output_file:
for line in content:
output_file.write(line.replace("|version|",
app.config.version))
diff --git a/docs/exts/provider_init_hack.py b/docs/exts/provider_init_hack.py
index e9ff142e82..be34d13b3a 100644
--- a/docs/exts/provider_init_hack.py
+++ b/docs/exts/provider_init_hack.py
@@ -37,7 +37,7 @@ def _create_init_py(app, config):
del config
# This file is deleted by /docs/build_docs.py. If you are not using the
script, the file will be
# deleted by pre-commit.
- with open(PROVIDER_INIT_FILE, "wt"):
+ with open(PROVIDER_INIT_FILE, "w"):
pass
diff --git a/kubernetes_tests/test_base.py b/kubernetes_tests/test_base.py
index a5a690881d..0601b2ff55 100644
--- a/kubernetes_tests/test_base.py
+++ b/kubernetes_tests/test_base.py
@@ -52,7 +52,7 @@ class TestBase(unittest.TestCase):
ci = os.environ.get("CI")
if ci and ci.lower() == "true":
print("The resource dump will be uploaded as artifact of the CI
job")
- with open(output_file_path, "wt") as output_file:
+ with open(output_file_path, "w") as output_file:
print("=" * 80, file=output_file)
print(f"Describe resources for namespace {namespace}",
file=output_file)
print(f"Datetime: {datetime.utcnow()}", file=output_file)
diff --git a/tests/jobs/test_triggerer_job.py b/tests/jobs/test_triggerer_job.py
index b84392366a..5fa64c9c47 100644
--- a/tests/jobs/test_triggerer_job.py
+++ b/tests/jobs/test_triggerer_job.py
@@ -44,7 +44,7 @@ class TimeDeltaTrigger_(TimeDeltaTrigger):
self.delta = delta
async def run(self):
- with open(self.filename, "at") as f:
+ with open(self.filename, "a") as f:
f.write("hi\n")
async for event in super().run():
yield event