Skip to content

Commit

Permalink
Fix importlib_metadata import in aws utils (#40134)
Browse files Browse the repository at this point in the history
* Fix `importlib_metadata` import in aws utils

* reorder imports
  • Loading branch information
eladkal authored Jun 8, 2024
1 parent 27579cb commit 22bd188
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions airflow/providers/amazon/aws/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@

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
Expand Down Expand Up @@ -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]:
Expand Down

0 comments on commit 22bd188

Please sign in to comment.