Skip to content

Commit

Permalink
changed import structure back to only bringing in the namespace and a…
Browse files Browse the repository at this point in the history
…ccessing functions from that
  • Loading branch information
azaidi06 committed Dec 13, 2024
1 parent 8d2d4f5 commit 37fa589
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion idaes/apps/grid_integration/examples/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions idaes/apps/grid_integration/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions idaes/tests/prescient/test_prescient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 37fa589

Please sign in to comment.