Fixing flake8 warnings and errors

flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude benchmark

Excluding the benchmark directory (due to protobuf generated files)
Also removing some Python2 specific code
This commit is contained in:
Jacob Alexander
2019-09-26 22:18:28 -07:00
parent 1f0200af9c
commit b3021e4f6b
37 changed files with 536 additions and 452 deletions

View File

@@ -14,11 +14,11 @@ capnp.create_event_loop(threaded=True)
def parse_args():
parser = argparse.ArgumentParser(usage='Connects to the Example thread server \
parser = argparse.ArgumentParser(usage='Connects to the Example thread server \
at the given address and does some RPCs')
parser.add_argument("host", help="HOST:PORT")
parser.add_argument("host", help="HOST:PORT")
return parser.parse_args()
return parser.parse_args()
class StatusSubscriber(thread_capnp.Example.StatusSubscriber.Server):
@@ -30,29 +30,30 @@ class StatusSubscriber(thread_capnp.Example.StatusSubscriber.Server):
def start_status_thread(host):
client = capnp.TwoPartyClient(host)
cap = client.bootstrap().cast_as(thread_capnp.Example)
client = capnp.TwoPartyClient(host)
cap = client.bootstrap().cast_as(thread_capnp.Example)
subscriber = StatusSubscriber()
promise = cap.subscribeStatus(subscriber)
promise.wait()
subscriber = StatusSubscriber()
promise = cap.subscribeStatus(subscriber)
promise.wait()
def main(host):
client = capnp.TwoPartyClient(host)
cap = client.bootstrap().cast_as(thread_capnp.Example)
client = capnp.TwoPartyClient(host)
cap = client.bootstrap().cast_as(thread_capnp.Example)
status_thread = threading.Thread(target=start_status_thread, args=(host,))
status_thread.daemon = True
status_thread.start()
status_thread = threading.Thread(target=start_status_thread, args=(host,))
status_thread.daemon = True
status_thread.start()
print('main: {}'.format(time.time()))
cap.longRunning().wait()
print('main: {}'.format(time.time()))
cap.longRunning().wait()
print('main: {}'.format(time.time()))
cap.longRunning().wait()
print('main: {}'.format(time.time()))
print('main: {}'.format(time.time()))
cap.longRunning().wait()
print('main: {}'.format(time.time()))
cap.longRunning().wait()
print('main: {}'.format(time.time()))
cap.longRunning().wait()
print('main: {}'.format(time.time()))
if __name__ == '__main__':
main(parse_args().host)