Fixing remaining flake8 lint warnings

This commit is contained in:
Jacob Alexander
2019-12-11 22:44:44 -08:00
parent f9647aa9a7
commit fc75e4083d
21 changed files with 128 additions and 30 deletions

View File

@@ -5,6 +5,7 @@ import sys
import json
import capnp
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("command")
@@ -14,6 +15,7 @@ def parse_args():
return parser.parse_args()
def encode(schema_file, struct_name, **kwargs):
schema = capnp.load(schema_file)
@@ -24,6 +26,7 @@ def encode(schema_file, struct_name, **kwargs):
struct.write(sys.stdout)
def decode(schema_file, struct_name, defaults):
schema = capnp.load(schema_file)
@@ -32,6 +35,7 @@ def decode(schema_file, struct_name, defaults):
json.dump(struct.to_dict(defaults), sys.stdout)
def main():
args = parse_args()
@@ -39,7 +43,7 @@ def main():
kwargs = vars(args)
del kwargs['command']
globals()[command](**kwargs) # hacky way to get defined functions, and call function with name=command
globals()[command](**kwargs) # hacky way to get defined functions, and call function with name=command
main()

View File

@@ -4,15 +4,16 @@ import os
import sys
import capnp
capnp.add_import_hook([os.getcwd(), "/usr/local/include/"]) # change this to be auto-detected?
capnp.add_import_hook([os.getcwd(), "/usr/local/include/"]) # change this to be auto-detected?
import test_capnp # noqa: E402
import test_capnp # noqa: E402
def decode(name):
class_name = name[0].upper() + name[1:]
print(getattr(test_capnp, class_name).from_bytes(sys.stdin.read())._short_str())
def encode(name):
val = getattr(test_capnp, name)
class_name = name[0].upper() + name[1:]