diff --git a/idaes/apps/grid_integration/examples/utils.py b/idaes/apps/grid_integration/examples/utils.py index 1675704485..cf6185dc84 100644 --- a/idaes/apps/grid_integration/examples/utils.py +++ b/idaes/apps/grid_integration/examples/utils.py @@ -11,7 +11,7 @@ # for full copyright and license information. ################################################################################# -from importlib.resources import as_file, files +from importlib import resources from pathlib import Path import os diff --git a/idaes/apps/grid_integration/tests/test_integration.py b/idaes/apps/grid_integration/tests/test_integration.py index 1d9dfd2c62..70d6707d14 100644 --- a/idaes/apps/grid_integration/tests/test_integration.py +++ b/idaes/apps/grid_integration/tests/test_integration.py @@ -11,7 +11,7 @@ # for full copyright and license information. ################################################################################# -from importlib.resources import as_file, file +from importlib import resources from numbers import Number from pathlib import Path from typing import Dict, Union @@ -50,8 +50,8 @@ def data_path(self) -> Path: # we need to specify __init__.py as a workaround for Python 3.9, # where importlib.resources.path() requires the resource to be a file # directories are not supported and will raise an error if attempted - with as_file( - files("idaes.tests.prescient.5bus").joinpath("__init__.py") + with resources.as_file( + resources.files("idaes.tests.prescient.5bus").joinpath("__init__.py") ) as pkg_file: prescient_5bus = Path(pkg_file).parent @@ -73,8 +73,8 @@ def self_scheduler_output_dir(self, tmp_path: Path) -> Path: @pytest.fixture def self_scheduler_plugin_path(self) -> Path: - with as_file( - files("idaes.apps.grid_integration.tests").joinpath( + with resources.as_file( + resources.files("idaes.apps.grid_integration.tests").joinpath( "self_scheduler_integration_test_plugin.py" ) ) as p: diff --git a/idaes/tests/prescient/test_prescient.py b/idaes/tests/prescient/test_prescient.py index c1c6f125b8..9e3746bd6c 100644 --- a/idaes/tests/prescient/test_prescient.py +++ b/idaes/tests/prescient/test_prescient.py @@ -11,7 +11,7 @@ # for full copyright and license information. ################################################################################# -from importlib.resources import files, as_file +from importlib import resources from numbers import Number from pathlib import Path from typing import Dict, Union @@ -33,8 +33,8 @@ def data_path(self) -> Path: # we need to specify __init__.py as a workaround for Python 3.9, # where importlib.resources.path() requires the resource to be a file # directories are not supported and will raise an error if attempted - with as_file( - files("idaes.tests.prescient.5bus").joinpath("__init__.py") + with resources.as_file( + resources.files("idaes.tests.prescient.5bus").joinpath("__init__.py") ) as pkg_file: prescient_5bus = Path(pkg_file).parent