From cf08b8411a3f847a1c2973a867b1744a6d19bb3b Mon Sep 17 00:00:00 2001 From: Quigley Malcolm Date: Mon, 8 Apr 2024 12:51:20 -0700 Subject: [PATCH] Remove try/except logic for importing `Empty` from `queue` library (#9877) Following [PEP8](https://peps.python.org/pep-0008/#package-and-module-names) the Python 2 library `Queue` was renamed to `queue` in [Python 3](https://peps.python.org/pep-3108/#pep-8-violations-done). Our try/except logic was to ensure the `Empty` class was imported without error when running Python 2. Python 2 went EOL January 1st, 2020 and we haven't supported Python 2 in a very long time. As such, it seems past time to remove this relic. --- tests/unit/test_graph.py | 7 +------ tests/unit/test_linker.py | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/tests/unit/test_graph.py b/tests/unit/test_graph.py index d4282bcff95..96e058796b8 100644 --- a/tests/unit/test_graph.py +++ b/tests/unit/test_graph.py @@ -20,12 +20,7 @@ from dbt.graph import NodeSelector, parse_difference from dbt.events.logging import setup_event_logger from dbt.mp_context import get_mp_context - -try: - from queue import Empty -except ImportError: - from Queue import Empty - +from queue import Empty from .utils import config_from_parts_or_dicts, generate_name_macros, inject_plugin diff --git a/tests/unit/test_linker.py b/tests/unit/test_linker.py index 9c36ae19674..973a41c062b 100644 --- a/tests/unit/test_linker.py +++ b/tests/unit/test_linker.py @@ -4,14 +4,9 @@ from unittest import mock from dbt import compilation - -try: - from queue import Empty -except ImportError: - from Queue import Empty - from dbt.graph.selector import NodeSelector from dbt.graph.cli import parse_difference +from queue import Empty def _mock_manifest(nodes):