summaryrefslogtreecommitdiff
path: root/lib/protocol_benchmarks.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2021-05-12 14:48:41 +0200
committerDaniel Friesel <daniel.friesel@uos.de>2021-05-12 14:48:41 +0200
commit09d4ad7a3f6e0f511c0eb49a54a782a0f22e2bcf (patch)
tree372ca671a905dd5d1c25eecb7951b630779fa885 /lib/protocol_benchmarks.py
parent72f14a8c447b24367a85967b424cbfb60e691727 (diff)
protocol_benchmarks: black(1)
Diffstat (limited to 'lib/protocol_benchmarks.py')
-rwxr-xr-xlib/protocol_benchmarks.py34
1 files changed, 21 insertions, 13 deletions
diff --git a/lib/protocol_benchmarks.py b/lib/protocol_benchmarks.py
index 1835263..8fa6620 100755
--- a/lib/protocol_benchmarks.py
+++ b/lib/protocol_benchmarks.py
@@ -327,8 +327,10 @@ class ArduinoJSON(DummyProtocol):
child = enc_node + "l"
while child in self.children:
child += "_"
- self.enc_buf += "ArduinoJson::JsonArray {} = {}.createNestedArray();\n".format(
- child, enc_node
+ self.enc_buf += (
+ "ArduinoJson::JsonArray {} = {}.createNestedArray();\n".format(
+ child, enc_node
+ )
)
self.children.add(child)
self.from_json(value, child)
@@ -337,8 +339,10 @@ class ArduinoJSON(DummyProtocol):
child = enc_node + "o"
while child in self.children:
child += "_"
- self.enc_buf += "ArduinoJson::JsonObject {} = {}.createNestedObject();\n".format(
- child, enc_node
+ self.enc_buf += (
+ "ArduinoJson::JsonObject {} = {}.createNestedObject();\n".format(
+ child, enc_node
+ )
)
self.children.add(child)
self.from_json(value, child)
@@ -615,11 +619,15 @@ class CapnProtoC(DummyProtocol):
[len(value)],
)
for i, elem in enumerate(value):
- self.enc_buf += "capn_set{:d}({}.{}, {:d}, capn_from_f{:d}({:f}));\n".format(
- self.float_bits, self.name, key, i, self.float_bits, elem
+ self.enc_buf += (
+ "capn_set{:d}({}.{}, {:d}, capn_from_f{:d}({:f}));\n".format(
+ self.float_bits, self.name, key, i, self.float_bits, elem
+ )
)
- self.dec_buf += "kout << capn_to_f{:d}(capn_get{:d}({}.{}, {:d}));\n".format(
- self.float_bits, self.float_bits, self.name, key, i
+ self.dec_buf += (
+ "kout << capn_to_f{:d}(capn_get{:d}({}.{}, {:d}));\n".format(
+ self.float_bits, self.float_bits, self.name, key, i
+ )
)
self.assign_and_kout(
self.float_type,
@@ -1195,8 +1203,10 @@ class NanoPB(DummyProtocol):
self.cc_encoders += (
"if (!pb_encode_tag_for_field(stream, field)) return false;\n"
)
- self.cc_encoders += 'return pb_encode_string(stream, (uint8_t*)"{}", {:d});\n'.format(
- value, len(value)
+ self.cc_encoders += (
+ 'return pb_encode_string(stream, (uint8_t*)"{}", {:d});\n'.format(
+ value, len(value)
+ )
)
self.cc_encoders += "}\n"
self.enc_buf += "msg.{}{}.funcs.encode = encode_{};\n".format(
@@ -1377,9 +1387,7 @@ class UBJ(DummyProtocol):
ret = 'kout << dec << "dec:";\n'
ret += self.dec_buf
ret += "kout << endl;\n"
- ret += (
- "ubjr_cleanup_dynamic(&dynamic_root);\n"
- ) # This causes the data (including all strings) to be free'd
+ ret += "ubjr_cleanup_dynamic(&dynamic_root);\n" # This causes the data (including all strings) to be free'd
ret += "ubjr_close_context(ctx);\n"
return ret