Skip to content

Commit

Permalink
Migrated from 'pkg_resources' to 'importlib'
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Dec 6, 2024
1 parent 67da6a6 commit c93d811
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions sklearn2pmml/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import pkg_resources
from importlib.resources import path

def _package_classpath():
jars = []
with open(pkg_resources.resource_filename("sklearn2pmml.resources", "classpath.txt")) as classpath:
jars = [pkg_resources.resource_filename("sklearn2pmml.resources", jar_name.strip()) for jar_name in classpath.readlines()]
return jars
with path("sklearn2pmml.resources", "classpath.txt") as classpath_file:
resources_dir = classpath_file.parent
with open(str(classpath_file), "r") as classpath:
jar_names = [line.strip("\n") for line in classpath.readlines()]
for jar_name in jar_names:
jar_file = resources_dir / jar_name
jars.append(str(jar_file))
return jars

0 comments on commit c93d811

Please sign in to comment.