Skip to content

Commit f6c9129

Browse files
authored
fix: fix entry point support in Python 3.9
1 parent fb2e4d0 commit f6c9129

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

pyannote/database/custom.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,18 @@
6767
from .loader import load_lst, load_trial
6868

6969
# All "Loader" classes types (eg RTTMLoader, UEMLoader, ...) retrieved from the entry point.
70-
LOADERS = {
71-
ep.name: ep
72-
for ep in entry_points(group="pyannote.database.loader")
73-
}
70+
try:
71+
# Python >= 3.10 style
72+
LOADERS = {
73+
ep.name: ep
74+
for ep in entry_points(group="pyannote.database.loader")
75+
}
76+
except TypeError:
77+
# Python < 3.10 style
78+
LOADERS = {
79+
ep.name: ep
80+
for ep in entry_points().get("pyannote.database.loader", [])
81+
}
7482

7583

7684
def Template(template: Text, database_yml: Path) -> Callable[[ProtocolFile], Any]:

0 commit comments

Comments
 (0)