Skip to content

Commit

Permalink
Remove try/except logic for importing Empty from queue library
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
QMalcolm committed Apr 8, 2024
1 parent e81f7fd commit 7853894
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
7 changes: 1 addition & 6 deletions tests/unit/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
7 changes: 1 addition & 6 deletions tests/unit/test_linker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 7853894

Please sign in to comment.