From bdef4cd0d15c572f17ca2685ea02f21a73c05a59 Mon Sep 17 00:00:00 2001 From: dirrao Date: Sun, 26 May 2024 20:45:41 +0530 Subject: [PATCH 1/8] mypy version bump 1.10.0 --- .pre-commit-config.yaml | 2 +- hatch_build.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0b06abeaf8d31..1af7f0c9812de 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -172,7 +172,7 @@ repos: entry: ./scripts/ci/pre_commit/update_common_sql_api_stubs.py language: python files: ^scripts/ci/pre_commit/update_common_sql_api\.py|^airflow/providers/common/sql/.*\.pyi?$ - additional_dependencies: ['rich>=12.4.4', 'mypy==1.9.0', 'black==23.10.0', 'jinja2'] + additional_dependencies: ['rich>=12.4.4', 'mypy==1.10.0', 'black==23.10.0', 'jinja2'] pass_filenames: false require_serial: true - id: update-black-version diff --git a/hatch_build.py b/hatch_build.py index 50e5bb774054d..8d503b500d82a 100644 --- a/hatch_build.py +++ b/hatch_build.py @@ -221,7 +221,7 @@ # TODO: upgrade to newer versions of MyPy continuously as they are released # Make sure to upgrade the mypy version in update-common-sql-api-stubs in .pre-commit-config.yaml # when you upgrade it here !!!! - "mypy==1.9.0", + "mypy==1.10.0", "types-Deprecated", "types-Markdown", "types-PyMySQL", From 327d3b388610e6b8cc279fc24a57502a6cd0106b Mon Sep 17 00:00:00 2001 From: dirrao Date: Mon, 27 May 2024 15:22:42 +0530 Subject: [PATCH 2/8] mypy version bump 1.10.0 --- airflow/providers/samba/hooks/samba.py | 2 +- airflow/providers/samba/transfers/gcs_to_samba.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/airflow/providers/samba/hooks/samba.py b/airflow/providers/samba/hooks/samba.py index 895c885d92205..16aa1b330d4a2 100644 --- a/airflow/providers/samba/hooks/samba.py +++ b/airflow/providers/samba/hooks/samba.py @@ -256,7 +256,7 @@ def push_from_local(self, destination_filepath: str, local_filepath: str, buffer speed up large file transfers """ extra_args = (buffer_size,) if buffer_size else () - with open(local_filepath, "rb") as f, self.open_file(destination_filepath, mode="wb") as g: + with open(local_filepath, "rb") as f, self.open_file(path=destination_filepath, mode="wb") as g: copyfileobj(f, g, *extra_args) @classmethod diff --git a/airflow/providers/samba/transfers/gcs_to_samba.py b/airflow/providers/samba/transfers/gcs_to_samba.py index bddc038b736ed..e3d262f65e3b6 100644 --- a/airflow/providers/samba/transfers/gcs_to_samba.py +++ b/airflow/providers/samba/transfers/gcs_to_samba.py @@ -196,7 +196,7 @@ def _copy_single_object( ) dir_path = os.path.dirname(destination_path) - samba_hook.makedirs(dir_path, exist_ok=True) + samba_hook.makedirs(path=dir_path, exist_ok=True) with NamedTemporaryFile("w") as tmp: gcs_hook.download( From 93bd25920ab91afca7c2668dd5d9f4b0e7b78235 Mon Sep 17 00:00:00 2001 From: dirrao Date: Mon, 27 May 2024 19:52:02 +0530 Subject: [PATCH 3/8] mypy version bump 1.10.0 --- airflow/providers/samba/hooks/samba.py | 2 +- airflow/providers/samba/transfers/gcs_to_samba.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/airflow/providers/samba/hooks/samba.py b/airflow/providers/samba/hooks/samba.py index 16aa1b330d4a2..895c885d92205 100644 --- a/airflow/providers/samba/hooks/samba.py +++ b/airflow/providers/samba/hooks/samba.py @@ -256,7 +256,7 @@ def push_from_local(self, destination_filepath: str, local_filepath: str, buffer speed up large file transfers """ extra_args = (buffer_size,) if buffer_size else () - with open(local_filepath, "rb") as f, self.open_file(path=destination_filepath, mode="wb") as g: + with open(local_filepath, "rb") as f, self.open_file(destination_filepath, mode="wb") as g: copyfileobj(f, g, *extra_args) @classmethod diff --git a/airflow/providers/samba/transfers/gcs_to_samba.py b/airflow/providers/samba/transfers/gcs_to_samba.py index e3d262f65e3b6..bddc038b736ed 100644 --- a/airflow/providers/samba/transfers/gcs_to_samba.py +++ b/airflow/providers/samba/transfers/gcs_to_samba.py @@ -196,7 +196,7 @@ def _copy_single_object( ) dir_path = os.path.dirname(destination_path) - samba_hook.makedirs(path=dir_path, exist_ok=True) + samba_hook.makedirs(dir_path, exist_ok=True) with NamedTemporaryFile("w") as tmp: gcs_hook.download( From b0b19bec88803f674935e382274fed1a92721b02 Mon Sep 17 00:00:00 2001 From: dirrao Date: Fri, 26 Jul 2024 16:30:12 +0530 Subject: [PATCH 4/8] mypy version bump 1.11.0 --- .pre-commit-config.yaml | 2 +- hatch_build.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1af7f0c9812de..5ae7d812f8605 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -172,7 +172,7 @@ repos: entry: ./scripts/ci/pre_commit/update_common_sql_api_stubs.py language: python files: ^scripts/ci/pre_commit/update_common_sql_api\.py|^airflow/providers/common/sql/.*\.pyi?$ - additional_dependencies: ['rich>=12.4.4', 'mypy==1.10.0', 'black==23.10.0', 'jinja2'] + additional_dependencies: ['rich>=12.4.4', 'mypy==1.11.0', 'black==23.10.0', 'jinja2'] pass_filenames: false require_serial: true - id: update-black-version diff --git a/hatch_build.py b/hatch_build.py index 8d503b500d82a..9faa809fad8ab 100644 --- a/hatch_build.py +++ b/hatch_build.py @@ -221,7 +221,7 @@ # TODO: upgrade to newer versions of MyPy continuously as they are released # Make sure to upgrade the mypy version in update-common-sql-api-stubs in .pre-commit-config.yaml # when you upgrade it here !!!! - "mypy==1.10.0", + "mypy==1.11.0", "types-Deprecated", "types-Markdown", "types-PyMySQL", From 001441d853d9283928226ab7eabe241b0c519e64 Mon Sep 17 00:00:00 2001 From: dirrao Date: Mon, 29 Jul 2024 17:31:22 +0530 Subject: [PATCH 5/8] replaced keyword argument with positional argument --- tests/dags/test_task_view_type_check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/dags/test_task_view_type_check.py b/tests/dags/test_task_view_type_check.py index cb81e410fdb24..142aa6eac8c97 100644 --- a/tests/dags/test_task_view_type_check.py +++ b/tests/dags/test_task_view_type_check.py @@ -46,7 +46,7 @@ def a_function(_, __): """A function with two args""" -partial_function = functools.partial(a_function, arg_x=1) +partial_function = functools.partial(a_function, 1) class_instance = CallableClass() logger.info("class_instance type: %s", type(class_instance)) From a61a51711f60ef67e117ff0ec81aaa0135bddf79 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Mon, 5 Aug 2024 17:31:24 +0800 Subject: [PATCH 6/8] Add ignore to cast() call Mypy is weirdly complaining it can't convert a callable to a TaskDecoratorCollection since the type is not callable. This is wrong in both ways---TaskDecoratorCollection *is* totally callable, and isn't cast() supposed to not care anyway? I don't see there's a viable way to work around this without significantly impacting typing in other ways, so an ignore marker seems to be the most reasonable option. The cast() call is kept because Mypy might fix this ins the future, and when it does, it should report the marker as redundant and prompt us to remove it. --- airflow/models/dag.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/models/dag.py b/airflow/models/dag.py index aa294cd465094..00b1f1368bc74 100644 --- a/airflow/models/dag.py +++ b/airflow/models/dag.py @@ -2757,7 +2757,7 @@ def get_tree_view(self) -> str: def task(self) -> TaskDecoratorCollection: from airflow.decorators import task - return cast("TaskDecoratorCollection", functools.partial(task, dag=self)) + return cast("TaskDecoratorCollection", functools.partial(task, dag=self)) # type: ignore[misc] def add_task(self, task: Operator) -> None: """ From 3b04f100b55984f69c9966fdf3c44b0983d02c1c Mon Sep 17 00:00:00 2001 From: dirrao Date: Sat, 14 Sep 2024 10:10:24 +0530 Subject: [PATCH 7/8] mypy version bump 1.11.2 --- .pre-commit-config.yaml | 2 +- hatch_build.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 94f5265959199..fcc7a0200bdc6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -172,7 +172,7 @@ repos: entry: ./scripts/ci/pre_commit/update_common_sql_api_stubs.py language: python files: ^scripts/ci/pre_commit/update_common_sql_api\.py|^airflow/providers/common/sql/.*\.pyi?$ - additional_dependencies: ['rich>=12.4.4', 'mypy==1.11.0', 'black==23.10.0', 'jinja2'] + additional_dependencies: ['rich>=12.4.4', 'mypy==1.11.2', 'black==23.10.0', 'jinja2'] pass_filenames: false require_serial: true - id: update-black-version diff --git a/hatch_build.py b/hatch_build.py index fe7bbcfafc8eb..7e41df4c5a97d 100644 --- a/hatch_build.py +++ b/hatch_build.py @@ -225,7 +225,7 @@ # TODO: upgrade to newer versions of MyPy continuously as they are released # Make sure to upgrade the mypy version in update-common-sql-api-stubs in .pre-commit-config.yaml # when you upgrade it here !!!! - "mypy==1.11.0", + "mypy==1.11.2", "types-Deprecated", "types-Markdown", "types-PyMySQL", From e59bdd5eb11b77d2343aec2ccc59eff937173199 Mon Sep 17 00:00:00 2001 From: dirrao Date: Fri, 18 Oct 2024 13:56:56 +0530 Subject: [PATCH 8/8] mypy version bump 1.12.0 --- .pre-commit-config.yaml | 2 +- hatch_build.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bbdae5690c3a8..c34fa96148cb7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -173,7 +173,7 @@ repos: entry: ./scripts/ci/pre_commit/update_common_sql_api_stubs.py language: python files: ^scripts/ci/pre_commit/update_common_sql_api\.py|^providers/src/airflow/providers/common/sql/.*\.pyi?$ - additional_dependencies: ['rich>=12.4.4', 'mypy==1.11.2', 'black==23.10.0', 'jinja2'] + additional_dependencies: ['rich>=12.4.4', 'mypy==1.12.0', 'black==23.10.0', 'jinja2'] pass_filenames: false require_serial: true - id: update-black-version diff --git a/hatch_build.py b/hatch_build.py index e1b4524dae531..909f38ef03b85 100644 --- a/hatch_build.py +++ b/hatch_build.py @@ -214,7 +214,7 @@ # TODO: upgrade to newer versions of MyPy continuously as they are released # Make sure to upgrade the mypy version in update-common-sql-api-stubs in .pre-commit-config.yaml # when you upgrade it here !!!! - "mypy==1.11.2", + "mypy==1.12.0", "types-Deprecated", "types-Markdown", "types-PyMySQL",