Skip to content

Commit 4267256

Browse files
committed
Switch from pkg_resources to importlib.resources
1 parent 771b192 commit 4267256

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

geometric_features/geometric_features.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
unicode_literals
33

44
import json
5-
import pkg_resources
5+
import importlib.resources
66
import os
77

88
import geometric_features
@@ -63,11 +63,10 @@ def __init__(self, cacheLocation=None, remoteBranchOrTag=None):
6363
else:
6464
self.remoteBranch = remoteBranchOrTag
6565

66-
featuresAndTagsFileName = pkg_resources.resource_filename(
67-
'geometric_features', 'features_and_tags.json')
68-
69-
with open(featuresAndTagsFileName) as f:
70-
self.allFeaturesAndTags = json.load(f)
66+
features_file = (importlib.resources.files('geometric_features') /
67+
'features_and_tags.json')
68+
with features_file.open('r') as file:
69+
self.allFeaturesAndTags = json.load(file)
7170

7271
def read(self, componentName, objectType, featureNames=None, tags=None,
7372
allTags=True):

0 commit comments

Comments
 (0)