Skip to content

Commit 1d89e82

Browse files
Your Namepeterbarker
authored andcommitted
Correct import of MutableMapping for Python 3.10
1 parent c7143e0 commit 1d89e82

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

dronekit/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@
3232
----
3333
"""
3434

35+
import sys
3536
import collections
37+
38+
# Python3.10 removed MutableMapping from collections:
39+
if sys.version_info.major == 3 and sys.version_info.minor >= 10:
40+
from collections.abc import MutableMapping
41+
else:
42+
from collections import MutableMapping
43+
3644
import copy
3745
import logging
3846
import math
@@ -2723,7 +2731,7 @@ def __str__(self):
27232731
return "Gimbal: pitch={0}, roll={1}, yaw={2}".format(self.pitch, self.roll, self.yaw)
27242732

27252733

2726-
class Parameters(collections.MutableMapping, HasObservers):
2734+
class Parameters(MutableMapping, HasObservers):
27272735
"""
27282736
This object is used to get and set the values of named parameters for a vehicle. See the following links for information about
27292737
the supported parameters for each platform: `Copter Parameters <http://copter.ardupilot.com/wiki/configuration/arducopter-parameters/>`_,

0 commit comments

Comments
 (0)