Skip to content

Commit

Permalink
using resources.file
Browse files Browse the repository at this point in the history
  • Loading branch information
dlakaplan committed Oct 18, 2024
1 parent 44ff0c6 commit 3150b6d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pint/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def datadir() -> str:
str
Directory of PINT data files
"""
return importlib.resources.path("pint", "data/")
return os.path.join(importlib.resources.files("pint"), "data/")


def examplefile(filename: str) -> str:
Expand All @@ -35,7 +35,7 @@ def examplefile(filename: str) -> str:
This is **not** for files needed at runtime. Those are located by :func:`pint.config.runtimefile`.
This is for files needed for the example notebooks.
"""
return importlib.resources.path("pint", "data", "examples", filename)
return os.path.join(importlib.resources.files("pint"), f"data/examples/{filename}")


def runtimefile(filename: str) -> str:
Expand All @@ -55,4 +55,4 @@ def runtimefile(filename: str) -> str:
This **is** for files needed at runtime. Files needed for the example notebooks
are found via :func:`pint.config.examplefile`.
"""
return importlib.resources.path("pint", "data", "runtime", filename)
return os.path.join(importlib.resources.files("pint"), f"data/runtime/{filename}")

0 comments on commit 3150b6d

Please sign in to comment.