Skip to content
This repository was archived by the owner on Sep 13, 2023. It is now read-only.

Commit 7018b9b

Browse files
committed
Slightly less verbose
1 parent 7eaafcf commit 7018b9b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mlem/utils/module.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import sys
99
import threading
1010
import warnings
11-
import importlib.metadata
11+
from importlib.metadata import distribution, PackageNotFoundError
1212
from collections import defaultdict
1313
from functools import lru_cache, wraps
1414
from pickle import PickleError
@@ -255,9 +255,9 @@ def get_module_version(mod: ModuleType) -> Optional[str]:
255255
try:
256256
if mod.__name__ in package_to_distros:
257257
for distro_name in package_to_distros[mod.__name__]:
258-
distro = importlib.metadata.distribution(distro_name)
258+
distro = distribution(distro_name)
259259
return distro.version
260-
except importlib.metadata.PackageNotFoundError:
260+
except PackageNotFoundError:
261261
pass
262262

263263
# if there's a package-file, try to get it from there

0 commit comments

Comments
 (0)