Fixing flake8 linting errors

This commit is contained in:
Jacob Alexander
2019-10-15 01:08:11 -07:00
parent 0e830c2127
commit 7789ebbf96
5 changed files with 27 additions and 32 deletions

View File

@@ -4,7 +4,6 @@ import subprocess
import os import os
import shutil import shutil
import sys import sys
import tempfile
def build_libcapnp(bundle_dir, build_dir, verbose=False): def build_libcapnp(bundle_dir, build_dir, verbose=False):
''' '''

View File

@@ -26,16 +26,16 @@ class PowerFunction(calculator_capnp.Calculator.Function.Server):
async def myreader(client, reader): async def myreader(client, reader):
while True: while True:
data = await reader.read(4096) data = await reader.read(4096)
client.write(data) client.write(data)
async def mywriter(client, writer): async def mywriter(client, writer):
while True: while True:
data = await client.read(4096) data = await client.read(4096)
writer.write(data.tobytes()) writer.write(data.tobytes())
await writer.drain() await writer.drain()
def parse_args(): def parse_args():
@@ -52,16 +52,16 @@ async def main(host):
port = host[1] port = host[1]
# Handle both IPv4 and IPv6 cases # Handle both IPv4 and IPv6 cases
try: try:
print("Try IPv4") print("Try IPv4")
reader, writer = await asyncio.open_connection( reader, writer = await asyncio.open_connection(
addr, port, addr, port,
) )
except: except Exception:
print("Try IPv6") print("Try IPv6")
reader, writer = await asyncio.open_connection( reader, writer = await asyncio.open_connection(
addr, port, addr, port,
family=socket.AF_INET6 family=socket.AF_INET6
) )
# Start TwoPartyClient using TwoWayPipe (takes no arguments in this mode) # Start TwoPartyClient using TwoWayPipe (takes no arguments in this mode)
client = capnp.TwoPartyClient() client = capnp.TwoPartyClient()

View File

@@ -4,23 +4,22 @@ from __future__ import print_function
import argparse import argparse
import asyncio import asyncio
import socket import socket
import random
import capnp import capnp
import calculator_capnp import calculator_capnp
async def myreader(client, reader): async def myreader(client, reader):
while True: while True:
data = await reader.read(4096) data = await reader.read(4096)
await client.write(data) await client.write(data)
async def mywriter(client, writer): async def mywriter(client, writer):
while True: while True:
data = await client.read(4096) data = await client.read(4096)
writer.write(data.tobytes()) writer.write(data.tobytes())
await writer.drain() await writer.drain()
def read_value(value): def read_value(value):
@@ -167,7 +166,7 @@ async def main():
myserver, myserver,
addr, port, addr, port,
) )
except: except Exception:
print("Try IPv6") print("Try IPv6")
server = await asyncio.start_server( server = await asyncio.start_server(
myserver, myserver,

View File

@@ -6,10 +6,10 @@ import asyncio
import argparse import argparse
import os import os
import time import time
import capnp
import socket import socket
import ssl import ssl
import time
import capnp
import thread_capnp import thread_capnp
@@ -51,7 +51,6 @@ async def mywriter(client, writer):
# to try again # to try again
data = await asyncio.wait_for(client.read(4096), timeout=1.0) data = await asyncio.wait_for(client.read(4096), timeout=1.0)
writer.write(data.tobytes()) writer.write(data.tobytes())
#await writer.drain()
except asyncio.TimeoutError: except asyncio.TimeoutError:
continue continue

View File

@@ -1,8 +1,6 @@
import gc
import os import os
import socket import socket
import subprocess import subprocess
import sys # add examples dir to sys.path
import time import time
examples_dir = os.path.join(os.path.dirname(__file__), '..', 'examples') examples_dir = os.path.join(os.path.dirname(__file__), '..', 'examples')