[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_target.py b/lib/xos-genx/xos-genx-tests/test_target.py
index d729be7..c468018 100644
--- a/lib/xos-genx/xos-genx-tests/test_target.py
+++ b/lib/xos-genx/xos-genx-tests/test_target.py
@@ -1,4 +1,3 @@
-
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,24 +22,25 @@
TEST_OUTPUT = "Do re mi fa so la ti do"
-class XProtoTargetTests(unittest.TestCase):
+class XProtoTargetTests(unittest.TestCase):
def setUp(self):
- test_file = open(os.path.join(OUTPUT_DIR, TEST_FILE), 'w')
+ test_file = open(os.path.join(OUTPUT_DIR, TEST_FILE), "w")
test_file.write(TEST_OUTPUT)
test_file.close()
def test_file_methods(self):
target = XProtoTestHelpers.write_tmp_target(
-"""
+ """
{%% if file_exists("%s") %%}
{{ include_file("%s") }}
{%% endif %%}
-"""%(TEST_FILE, TEST_FILE)
+"""
+ % (TEST_FILE, TEST_FILE)
)
args = XOSProcessorArgs()
- args.inputs = ''
+ args.inputs = ""
args.target = target
args.attic = OUTPUT_DIR
output = XOSProcessor.process(args)
@@ -48,30 +48,31 @@
def test_xproto_lib(self):
target = XProtoTestHelpers.write_tmp_target(
-"""
+ """
{{ xproto_first_non_empty([None, None, None, None, None, None, "Eureka"]) }}
-""")
+"""
+ )
args = XOSProcessorArgs()
- args.inputs = ''
+ args.inputs = ""
args.target = target
output = XOSProcessor.process(args)
self.assertIn("Eureka", output)
def test_context(self):
target = XProtoTestHelpers.write_tmp_target(
-"""
+ """
{{ context.what }}
-""")
+"""
+ )
args = XOSProcessorArgs()
- args.inputs = ''
+ args.inputs = ""
args.target = target
- args.kv='what:what is what'
+ args.kv = "what:what is what"
output = XOSProcessor.process(args)
self.assertIn("what is what", output)
def test_singularize(self):
- proto = \
-"""
+ proto = """
message TestSingularize {
// The following field has an explicitly specified singular
required int many = 1 [singular = "one"];
@@ -84,20 +85,22 @@
"""
target = XProtoTestHelpers.write_tmp_target(
-"""
+ """
{% for m in proto.messages.0.fields -%}
{{ xproto_singularize(m) }},
{%- endfor %}
-""")
+"""
+ )
args = XOSProcessorArgs()
args.inputs = proto
args.target = target
output = XOSProcessor.process(args)
- self.assertEqual("one,sheep,slice,network,omf_friendly", output.lstrip().rstrip().rstrip(','))
+ self.assertEqual(
+ "one,sheep,slice,network,omf_friendly", output.lstrip().rstrip().rstrip(",")
+ )
def test_pluralize(self):
- proto = \
-"""
+ proto = """
message TestPluralize {
// The following field has an explicitly specified plural
required int anecdote = 1 [plural = "data"];
@@ -110,18 +113,21 @@
"""
target = XProtoTestHelpers.write_tmp_target(
-"""
+ """
{% for m in proto.messages.0.fields -%}
{{ xproto_pluralize(m) }},
{%- endfor %}
-""")
+"""
+ )
args = XOSProcessorArgs()
args.inputs = proto
args.target = target
output = XOSProcessor.process(args)
- self.assertEqual("data,sheep,slices,networks,omf_friendlies", output.lstrip().rstrip().rstrip(','))
+ self.assertEqual(
+ "data,sheep,slices,networks,omf_friendlies",
+ output.lstrip().rstrip().rstrip(","),
+ )
-if __name__ == '__main__':
+
+if __name__ == "__main__":
unittest.main()
-
-