From 4ffcb4e21867f1e82d03cb3f205364a657fc1177 Mon Sep 17 00:00:00 2001 From: Kaxil Naik Date: Thu, 31 Oct 2024 22:16:53 +0000 Subject: [PATCH] Drop redundant code since Airflow 3 is Python `>=3.9` (#43563) --- 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")