Skip to content

Commit

Permalink
fixup! Issue #460 replace (deprecated) pgk_resources with importlib.r…
Browse files Browse the repository at this point in the history
…esources
  • Loading branch information
soxofaan committed Aug 28, 2023
1 parent 25105f9 commit 69f8c20
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions openeo/extra/spectral_indices/spectral_indices.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import json
import importlib.resources
from typing import Dict, List

import numpy as np

from openeo.processes import ProcessBuilder, array_modify, array_create
from openeo.rest.datacube import DataCube

try:
import importib_resources
except ImportError:
import importlib.resources as importlib_resources


BAND_MAPPING_LANDSAT457 = {
"B1": "B",
"B2": "G",
Expand Down Expand Up @@ -89,7 +94,7 @@ def load_indices() -> Dict[str, dict]:
"resources/awesome-spectral-indices/spectral-indices-dict.json",
"resources/extra-indices-dict.json",
]:
with importlib.resources.files("openeo.extra.spectral_indices") / path as resource_path:
with importlib_resources.files("openeo.extra.spectral_indices") / path as resource_path:
data = json.loads(resource_path.read_text(encoding="utf8"))
specs.update(data["SpectralIndices"])

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"pandas>0.20.0",
"deprecated>=1.2.12",
'oschmod>=0.3.12; sys_platform == "win32"',
"importlib_resources; python_version<'3.10'",
],
extras_require={
"tests": tests_require,
Expand Down

0 comments on commit 69f8c20

Please sign in to comment.