From 8b843e1028beb2a3fd429bf897d177dd9c6fa7d5 Mon Sep 17 00:00:00 2001 From: Kaxil Naik Date: Thu, 31 Oct 2024 21:29:54 +0000 Subject: [PATCH] Drop redundant code since Airflow 3 is Python `>=3.9` Some of these checks are now redundant since we dropped support for Py < 3.9 in https://github.com/apache/airflow/pull/42766 --- airflow/utils/hashlib_wrapper.py | 5 +---- tests/io/test_path.py | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/airflow/utils/hashlib_wrapper.py b/airflow/utils/hashlib_wrapper.py index f48a093bb270a..164b52bbdb178 100644 --- a/airflow/utils/hashlib_wrapper.py +++ b/airflow/utils/hashlib_wrapper.py @@ -18,7 +18,6 @@ from __future__ import annotations import hashlib -import sys from typing import TYPE_CHECKING if TYPE_CHECKING: @@ -32,6 +31,4 @@ def md5(__string: ReadableBuffer = b"") -> hashlib._Hash: :param __string: The data to hash. Default to empty str byte. :return: The hashed value. """ - if sys.version_info >= (3, 9): - return hashlib.md5(__string, usedforsecurity=False) # type: ignore - return hashlib.md5(__string) + return hashlib.md5(__string, usedforsecurity=False) # type: ignore diff --git a/tests/io/test_path.py b/tests/io/test_path.py index 9d944c5f51c3c..264e3a6d8c155 100644 --- a/tests/io/test_path.py +++ b/tests/io/test_path.py @@ -17,7 +17,6 @@ # under the License. from __future__ import annotations -import sys import uuid from stat import S_ISDIR, S_ISREG from tempfile import NamedTemporaryFile @@ -247,7 +246,6 @@ def test_replace(self): e.unlink() - @pytest.mark.skipif(sys.version_info < (3, 9), reason="`is_relative_to` new in version 3.9") def test_is_relative_to(self): uuid_dir = f"/tmp/{str(uuid.uuid4())}" o1 = ObjectStoragePath(f"file://{uuid_dir}/aaa")