Skip to content

Commit

Permalink
Refactored package classpath
Browse files Browse the repository at this point in the history
  • Loading branch information
vruusmann committed Dec 7, 2024
1 parent ecaff24 commit a3db51c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions sklearn2pmml/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from importlib.resources import path
from pathlib import Path

def _package_classpath():
sklearn2pmml_dir = Path(__import__("sklearn2pmml").__file__).parent
resources_dir = sklearn2pmml_dir / "resources"

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))
classpath_file = resources_dir / "classpath.txt"
with open(str(classpath_file), "r") as classpath:
jar_names = [line.rstrip("\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 a3db51c

Please sign in to comment.