Skip to content

Commit

Permalink
Replace deprecated pkg_resources.open_text
Browse files Browse the repository at this point in the history
Follow guidance from https://docs.python.org/3/library/importlib.resources.html#deprecated-functions

Signed-off-by: Michael Tiemann <72577720+MichaelTiemannOSC@users.noreply.github.com>
  • Loading branch information
MichaelTiemannOSC authored and rgieseke committed Dec 18, 2023
1 parent e5503df commit a7937b9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/globalwarmingpotentials/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ def as_frame():
"potentials as a Data Frame."
) from None

import importlib.resources as pkg_resources
from importlib.resources import files

return pd.read_csv(
pkg_resources.open_text(
"globalwarmingpotentials", "globalwarmingpotentials.csv"
),
files("globalwarmingpotentials").joinpath("globalwarmingpotentials.csv").open('r', encoding="utf-8"),
index_col=0,
comment="#",
)
Expand Down

0 comments on commit a7937b9

Please sign in to comment.