Skip to content

Commit

Permalink
chor: Use importlib.resources from the standard library
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Nov 11, 2024
1 parent 5b3387b commit 23b941b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 2 additions & 7 deletions singer_sdk/helpers/_resources.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
from __future__ import annotations

import sys
import importlib.resources
import typing as t

if t.TYPE_CHECKING:
from types import ModuleType

from singer_sdk.helpers._compat import Traversable

if sys.version_info < (3, 10):
import importlib_resources
else:
import importlib.resources as importlib_resources


def get_package_files(package: str | ModuleType) -> Traversable:
"""Load a file from a package.
Expand All @@ -24,4 +19,4 @@ def get_package_files(package: str | ModuleType) -> Traversable:
Returns:
The file as a Traversable object.
"""
return importlib_resources.files(package)
return importlib.resources.files(package)
4 changes: 2 additions & 2 deletions singer_sdk/testing/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from __future__ import annotations

import contextlib
import importlib.resources
import typing as t
import warnings

from singer_sdk.helpers._compat import importlib_resources
from singer_sdk.testing import target_test_streams

if t.TYPE_CHECKING:
Expand Down Expand Up @@ -337,4 +337,4 @@ def singer_filepath(self) -> Traversable:
Returns:
The expected Path to this tests singer file.
"""
return importlib_resources.files(target_test_streams) / f"{self.name}.singer"
return importlib.resources.files(target_test_streams) / f"{self.name}.singer"

0 comments on commit 23b941b

Please sign in to comment.