Skip to content

Commit 2718c07

Browse files
authored
fix for Python 3.10 (#197)
1 parent 113f57f commit 2718c07

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

experiments/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
from datetime import timedelta
1616

1717
import collections
18+
try:
19+
from collections.abc import Mapping
20+
except ImportError: # Python < 3.10
21+
from collections import Mapping
1822
import numbers
1923
import logging
2024
import json
@@ -87,7 +91,7 @@ def enroll(self, experiment_name, alternatives, force_alternative=None):
8791

8892
if experiment:
8993
if experiment.is_displaying_alternatives():
90-
if isinstance(alternatives, collections.Mapping):
94+
if isinstance(alternatives, Mapping):
9195
if conf.CONTROL_GROUP not in alternatives:
9296
experiment.ensure_alternative_exists(conf.CONTROL_GROUP, 1)
9397
for alternative, weight in alternatives.items():

0 commit comments

Comments
 (0)