[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/jinja2_extensions/checklib.py b/lib/xos-genx/xosgenx/jinja2_extensions/checklib.py
index db61f01..c361b64 100644
--- a/lib/xos-genx/xosgenx/jinja2_extensions/checklib.py
+++ b/lib/xos-genx/xosgenx/jinja2_extensions/checklib.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import absolute_import
import ast
@@ -27,13 +28,13 @@
except SyntaxError:
return "511 Could not parse sync step %s" % sync_step_path
- classes = filter(lambda x: isinstance(x, ast.ClassDef), sync_step_ast.body)
+ classes = [x for x in sync_step_ast.body if isinstance(x, ast.ClassDef)]
found_sync_step_class = False
for c in classes:
base_names = [v.id for v in c.bases]
if "SyncStep" in base_names or "SyncInstanceUsingAnsible" in base_names:
- attributes = filter(lambda x: isinstance(x, ast.Assign), c.body)
+ attributes = [x for x in c.body if isinstance(x, ast.Assign)]
for a in attributes:
target_names = [t.id for t in a.targets]
values = a.value.elts if isinstance(a.value, ast.List) else [a.value]
@@ -66,7 +67,7 @@
except SyntaxError:
return "511 Could not parse sync step %s" % model_policy_path
- classes = filter(lambda x: isinstance(x, ast.ClassDef), model_policy_ast.body)
+ classes = [x for x in model_policy_ast.body if isinstance(x, ast.ClassDef)]
found_model_policy_class = False
for c in classes:
base_names = [v.id for v in c.bases]