[SEBA-412] Automated reformat of Python code
Passes of modernize, autopep8, black, then check with flake8
flake8 + manual fixes:
lib/xos-config
lib/xos-kafka
lib/xos-util
xos/coreapi
xos/api
xos/xos_client
Change-Id: Ib23cf84cb13beb3c6381fa0d79594dc9131dc815
diff --git a/lib/xos-genx/xos-genx-tests/test_graph.py b/lib/xos-genx/xos-genx-tests/test_graph.py
index fda3d99..c6cfea7 100644
--- a/lib/xos-genx/xos-genx-tests/test_graph.py
+++ b/lib/xos-genx/xos-genx-tests/test_graph.py
@@ -1,4 +1,3 @@
-
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,10 +17,11 @@
from xosgenx.generator import XOSProcessor, XOSProcessorArgs
from helpers import XProtoTestHelpers
+
class XProtoGraphTests(unittest.TestCase):
def test_cross_model(self):
target = XProtoTestHelpers.write_tmp_target(
-"""
+ """
{% for m in proto.messages %}
{{ m.name }} {
{%- for l in m.links %}
@@ -34,10 +34,10 @@
{% endfor %}
}
{% endfor %}
-""")
-
- proto = \
"""
+ )
+
+ proto = """
message Port (PlCoreBase,ParameterMixin){
required manytoone network->Network:links = 1 [db_index = True, null = False, blank = False];
optional manytoone instance->Instance:ports = 2 [db_index = True, null = True, blank = True];
@@ -116,12 +116,13 @@
args.inputs = proto
args.target = target
output = XOSProcessor.process(args)
- num_semis = output.count(';')
- self.assertGreater(num_semis, 3) # 3 is the number of links, each of which contains at least one field
+ num_semis = output.count(";")
+ self.assertGreater(
+ num_semis, 3
+ ) # 3 is the number of links, each of which contains at least one field
def test_base_class_fields(self):
- target = \
-"""
+ target = """
{% for m in proto.messages %}
{{ m.name }} {
{%- for l in m.links %}
@@ -137,8 +138,7 @@
"""
xtarget = XProtoTestHelpers.write_tmp_target(target)
- proto = \
-"""
+ proto = """
message Port (PlCoreBase,ParameterMixin){
required manytoone network->Network:links = 1 [db_index = True, null = False, blank = False];
optional manytoone instance->Instance:ports = 2 [db_index = True, null = True, blank = True];
@@ -218,19 +218,17 @@
args.target = xtarget
output = XOSProcessor.process(args)
- num_semis = output.count(';')
+ num_semis = output.count(";")
self.assertGreater(num_semis, 3)
def test_from_base(self):
- target = \
-"""
+ target = """
{% for f in xproto_base_fields(proto.messages.3, proto.message_table) %}
{{ f.type }} {{ f.name }};
{% endfor %}
"""
xtarget = XProtoTestHelpers.write_tmp_target(target)
- proto = \
-"""
+ proto = """
message Port (PlCoreBase,ParameterMixin){
required string easter_egg = 1;
required manytoone network->Network:links = 1 [db_index = True, null = False, blank = False];
@@ -309,9 +307,8 @@
args.inputs = proto
args.target = xtarget
output = XOSProcessor.process(args)
- self.assertIn('easter_egg', output)
+ self.assertIn("easter_egg", output)
-if __name__ == '__main__':
+
+if __name__ == "__main__":
unittest.main()
-
-