[SEBA-450] (part 1)
Refactoring, python3 compat, and tox tests on:
- xosconfig
- xosgenx
- xosutil
Eliminate use of yaml.load() which is unsafe, switch to yaml.safe_load()
More diagnostics during database migration
Change-Id: I0fae5782fca401603a7c4e4ec2b9269ad24bda97
diff --git a/lib/xos-genx/xosgenx/proto2xproto.py b/lib/xos-genx/xosgenx/proto2xproto.py
index f1dc959..6157aee 100644
--- a/lib/xos-genx/xosgenx/proto2xproto.py
+++ b/lib/xos-genx/xosgenx/proto2xproto.py
@@ -12,19 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import absolute_import
-import plyxproto.model as m
-from plyxproto.helpers import Visitor
-import pdb
-import argparse
-import plyxproto.parser as plyxproto
-from plyxproto.logicparser import FOLParser, FOLLexer
-import traceback
-import sys
-import jinja2
-import os
import ply.lex as lex
import ply.yacc as yacc
+import plyxproto.model as m
+from plyxproto.helpers import Visitor
+from plyxproto.logicparser import FOLLexer, FOLParser
+from six.moves import map
class Stack(list):
@@ -136,7 +131,7 @@
except KeyError:
bases = []
- bases = map(lambda x: str_to_dict(x[1:-1]), bases)
+ bases = [str_to_dict(x[1:-1]) for x in bases]
obj.bases = bases
except KeyError:
raise
@@ -212,8 +207,8 @@
def visit_MessageDefinition_post(self, obj):
self.proto_to_xproto_message(obj)
- obj.body = filter(lambda x: not hasattr(x, "mark_for_deletion"), obj.body)
- obj.body = map(replace_link, obj.body)
+ obj.body = [x for x in obj.body if not hasattr(x, "mark_for_deletion")]
+ obj.body = list(map(replace_link, obj.body))
self.current_message_name = None
return True