Skip to content

Commit 99e0ba5

Browse files
cclausspeterbarker
authored andcommitted
Remove the six module and Python 2 compatibility code
1 parent e7fade9 commit 99e0ba5

File tree

7 files changed

+8
-24
lines changed

7 files changed

+8
-24
lines changed

MAVProxy/modules/lib/wxsettings_ui.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,7 @@ def on_load(self, event):
7171
setting = self.setting_map[label]
7272
ctrl = self.controls[label]
7373
value = ctrl.GetValue()
74-
75-
# Python 2 compatiblility - alternative is:
76-
# import six
77-
# isinstance(value, six.string_types)
78-
if isinstance(value, str) \
79-
or isinstance(value, str if sys.version_info[0] >= 3 else unicode):
74+
if isinstance(value, str):
8075
ctrl.SetValue(str(setting.value))
8176
else:
8277
ctrl.SetValue(setting.value)

MAVProxy/modules/mavproxy_SIYI/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,8 @@ def crc16_from_bytes(bytes, initial=0):
116116
# Check string: '123456789'
117117
# Check value: 0x29B1
118118

119-
try:
120-
if isinstance(bytes, basestring): # Python 2.7 compatibility
121-
bytes = map(ord, bytes)
122-
except NameError:
123-
if isinstance(bytes, str): # This branch will be taken on Python 3
124-
bytes = map(ord, bytes)
125-
119+
if isinstance(bytes, str):
120+
bytes = map(ord, bytes)
126121
crc = initial
127122
for byte in bytes:
128123
crc ^= byte << 8

MAVProxy/modules/mavproxy_map/mp_tile.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,7 @@ def __init__(self, cache_path=None, download=True, cache_size=500,
216216
self._download_thread = None
217217
self._loading = mp_icon('loading.jpg')
218218
self._unavailable = mp_icon('unavailable.jpg')
219-
try:
220-
self._tile_cache = collections.OrderedDict()
221-
except AttributeError:
222-
# OrderedDicts in python 2.6 come from the ordereddict module
223-
# which is a 3rd party package, not in python2.6 distribution
224-
import ordereddict
225-
self._tile_cache = ordereddict.OrderedDict()
219+
self._tile_cache = collections.OrderedDict()
226220

227221
def set_service(self, service):
228222
'''set tile service'''

MAVProxy/modules/mavproxy_smartcamera/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# it what cameras are connected, it then tries to connect to the
1313
# cameras and populates a list of available cameras.
1414
#
15-
# Environment : Python 2.7 Code. Intended to be included in MAVproxy as a Module
15+
# Environment : Intended to be included in MAVproxy as a Module
1616
#
1717
# Responsible : Jaime Machuca
1818
#

MAVProxy/modules/mavproxy_smartcamera/sc_ExifWriter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#
1414
# https://github.com/Escadrone/Solo-Mapper.git
1515
#
16-
# Environment : Python 2.7 Code. Intended to be included in MAVproxy as a Module
16+
# Environment : Intended to be included in MAVproxy as a Module
1717
#
1818
# Responsible : Jaime Machuca
1919
#

MAVProxy/modules/mavproxy_smartcamera/sc_SonyQX1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# have support for triggering the camera, and downloading the
1111
# latest image file. Other functions will be added gradually.
1212
#
13-
# Environment : Python 2.7 Code. Intended to be included in a Mavproxy Module
13+
# Environment : Intended to be included in a Mavproxy Module
1414
#
1515
# Responsible : Jaime Machuca
1616
#

windows/mavproxy.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ MAVProxyAny = Analysis(['mavproxy.py'],
1212
'wx.lib.agw.genericmessagedialog', 'wx.lib.wordwrap', 'wx.lib.buttons',
1313
'wx.lib.embeddedimage', 'wx.lib.imageutils', 'wx.lib.agw.aquabutton',
1414
'wx.lib.agw.gradientbutton',
15-
'six','packaging', 'packaging.version', 'packaging.specifiers',
15+
'packaging', 'packaging.version', 'packaging.specifiers',
1616
'requests',
1717
] + collect_submodules('MAVProxy.modules') +
1818
collect_submodules('pymavlink') + collect_submodules('yaml') + collect_submodules('pygame'),

0 commit comments

Comments
 (0)