File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
import pathlib
2
2
from typing import Dict , List , Text , Tuple
3
3
4
- import pkg_resources
5
-
4
+ import pkgutil
6
5
7
6
def axl_filename (path : pathlib .Path ) -> pathlib .Path :
8
7
"""Given a path under Axelrod/, return absolute filepath.
@@ -24,9 +23,11 @@ def axl_filename(path: pathlib.Path) -> pathlib.Path:
24
23
def load_file (filename : str , directory : str ) -> List [List [str ]]:
25
24
"""Loads a data file stored in the Axelrod library's data subdirectory,
26
25
likely for parameters for a strategy."""
27
- path = "/" .join ((directory , filename ))
28
- data_bytes = pkg_resources .resource_string (__name__ , path )
26
+
27
+ path = str (pathlib .Path (directory ) / filename )
28
+ data_bytes = pkgutil .get_data (__name__ , path )
29
29
data = data_bytes .decode ("UTF-8" , "replace" )
30
+
30
31
rows = []
31
32
for line in data .split ("\n " ):
32
33
if line .startswith ("#" ) or len (line ) == 0 :
You can’t perform that action at this time.
0 commit comments