mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 04:53:33 +08:00
More fixes for Python 3 compatibility (#13008)
* More fixes for Python 3 compatibility * Workaround if the six module is not pip installed * Lose the semicolons
This commit is contained in:
committed by
Julian Oes
parent
2a848c365c
commit
6dc55f97d4
@@ -3,10 +3,12 @@
|
||||
Script to read an yaml file containing the RTPS message IDs and update the naming convention to PascalCase
|
||||
"""
|
||||
|
||||
import errno
|
||||
import os
|
||||
import yaml
|
||||
import sys
|
||||
import argparse
|
||||
import six
|
||||
|
||||
__author__ = 'PX4 Development Team'
|
||||
__copyright__ = \
|
||||
@@ -91,14 +93,8 @@ def update_dict(list):
|
||||
if verbose:
|
||||
num_of_msgs = 0
|
||||
for i, dictionary in enumerate(list["rtps"]):
|
||||
# implementation depends on the Python version being used
|
||||
if sys.version_info[0] < 3:
|
||||
dict = {k: v.title().replace('_', '') if isinstance(
|
||||
v, basestring) else v for k, v in dictionary.iteritems()}
|
||||
else:
|
||||
dict = {k: v.title().replace('_', '') if isinstance(
|
||||
v, str) else v for k, v in dictionary.items()}
|
||||
list["rtps"][i] = dict
|
||||
list["rtps"][i] = {k: v.title().replace('_', '') if isinstance(
|
||||
v, six.string_types) else v for k, v in six.iteritems(dictionary)}
|
||||
if verbose:
|
||||
num_of_msgs += 1
|
||||
if verbose:
|
||||
|
||||
Reference in New Issue
Block a user