Skip to content

Commit

Permalink
Switch from pkg_resources to importlib.resources
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Dec 29, 2022
1 parent 771b192 commit 4267256
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions geometric_features/geometric_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
unicode_literals

import json
import pkg_resources
import importlib.resources
import os

import geometric_features
Expand Down Expand Up @@ -63,11 +63,10 @@ def __init__(self, cacheLocation=None, remoteBranchOrTag=None):
else:
self.remoteBranch = remoteBranchOrTag

featuresAndTagsFileName = pkg_resources.resource_filename(
'geometric_features', 'features_and_tags.json')

with open(featuresAndTagsFileName) as f:
self.allFeaturesAndTags = json.load(f)
features_file = (importlib.resources.files('geometric_features') /
'features_and_tags.json')
with features_file.open('r') as file:
self.allFeaturesAndTags = json.load(file)

def read(self, componentName, objectType, featureNames=None, tags=None,
allTags=True):
Expand Down

0 comments on commit 4267256

Please sign in to comment.