Skip to content

Commit 9fbef6f

Browse files
authored
fix: better implementation of this_module_path (#295)
1 parent 9daa581 commit 9fbef6f

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/correctionlib/util.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,5 @@ def this_module_path() -> pathlib.Path:
1212

1313
return pathlib.Path(pkg_resources.resource_filename("correctionlib", ""))
1414

15-
# get a real path out of the traversable
16-
paths = [
17-
p
18-
for p in importlib.resources.files("correctionlib").iterdir()
19-
if isinstance(p, pathlib.Path)
20-
]
21-
return pathlib.Path(paths[0].parent)
15+
with importlib.resources.path("correctionlib", "") as fspath:
16+
return fspath

0 commit comments

Comments
 (0)