diff --git a/src/ansible_navigator/constants.py b/src/ansible_navigator/constants.py index ad3485afa..9b31bde98 100644 --- a/src/ansible_navigator/constants.py +++ b/src/ansible_navigator/constants.py @@ -1,7 +1,7 @@ """Constants for ansible-navigator.""" import importlib.resources as importlib_resources -from importlib.abc import Traversable +from ansible_navigator.utils.compatibility import Traversable PKG_NAME: str = "ansible_navigator" diff --git a/src/ansible_navigator/ui_framework/colorize.py b/src/ansible_navigator/ui_framework/colorize.py index 43c00d53e..755b4fa76 100644 --- a/src/ansible_navigator/ui_framework/colorize.py +++ b/src/ansible_navigator/ui_framework/colorize.py @@ -11,12 +11,12 @@ import logging import re -from importlib.abc import Traversable from itertools import chain from ansible_navigator.tm_tokenize.grammars import Grammars from ansible_navigator.tm_tokenize.region import Regions from ansible_navigator.tm_tokenize.tokenize import tokenize +from ansible_navigator.utils.compatibility import Traversable from .curses_defs import CursesLine from .curses_defs import CursesLinePart diff --git a/src/ansible_navigator/ui_framework/ui_config.py b/src/ansible_navigator/ui_framework/ui_config.py index 50a1b4469..34a939c90 100644 --- a/src/ansible_navigator/ui_framework/ui_config.py +++ b/src/ansible_navigator/ui_framework/ui_config.py @@ -1,7 +1,8 @@ """Object to hold basic UI settings.""" from dataclasses import dataclass -from importlib.abc import Traversable + +from ansible_navigator.utils.compatibility import Traversable @dataclass diff --git a/src/ansible_navigator/utils/compatibility.py b/src/ansible_navigator/utils/compatibility.py index a30a6dd8e..ed1ebdff9 100644 --- a/src/ansible_navigator/utils/compatibility.py +++ b/src/ansible_navigator/utils/compatibility.py @@ -19,3 +19,9 @@ import importlib_metadata else: import importlib.metadata as importlib_metadata + + +if sys.version_info < (3, 12): + from importlib.abc import Traversable +else: + from importlib.resources.abc import Traversable