This is an automated email from the ASF dual-hosted git repository.

potiuk 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 22bd188439 Fix `importlib_metadata` import in aws utils (#40134)
22bd188439 is described below

commit 22bd1884397cb900d1cc825467f0f21539d53fa8
Author: Elad Kalif <[email protected]>
AuthorDate: Sat Jun 8 13:05:09 2024 +0300

    Fix `importlib_metadata` import in aws utils (#40134)
    
    * Fix `importlib_metadata` import in aws utils
    
    * reorder imports
---
 airflow/providers/amazon/aws/utils/__init__.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/airflow/providers/amazon/aws/utils/__init__.py 
b/airflow/providers/amazon/aws/utils/__init__.py
index 218ccc5768..e04d28869e 100644
--- a/airflow/providers/amazon/aws/utils/__init__.py
+++ b/airflow/providers/amazon/aws/utils/__init__.py
@@ -18,11 +18,15 @@ from __future__ import annotations
 
 import logging
 import re
+import sys
 from datetime import datetime, timezone
 from enum import Enum
 from typing import Any
 
-import importlib_metadata
+if sys.version_info >= (3, 10):
+    from importlib import metadata
+else:
+    import importlib_metadata as metadata  # type: ignore[no-redef]
 
 from airflow.exceptions import AirflowException
 from airflow.utils.helpers import prune_dict
@@ -78,7 +82,7 @@ def get_airflow_version() -> tuple[int, ...]:
 
 def get_botocore_version() -> tuple[int, ...]:
     """Return the version number of the installed botocore package in the form 
of a tuple[int,...]."""
-    return tuple(map(int, 
importlib_metadata.version("botocore").split(".")[:3]))
+    return tuple(map(int, metadata.version("botocore").split(".")[:3]))
 
 
 def validate_execute_complete_event(event: dict[str, Any] | None = None) -> 
dict[str, Any]:

Reply via email to