Fixing flake8 linting errors
This commit is contained in:
@@ -26,16 +26,16 @@ class PowerFunction(calculator_capnp.Calculator.Function.Server):
|
||||
|
||||
|
||||
async def myreader(client, reader):
|
||||
while True:
|
||||
data = await reader.read(4096)
|
||||
client.write(data)
|
||||
while True:
|
||||
data = await reader.read(4096)
|
||||
client.write(data)
|
||||
|
||||
|
||||
async def mywriter(client, writer):
|
||||
while True:
|
||||
data = await client.read(4096)
|
||||
writer.write(data.tobytes())
|
||||
await writer.drain()
|
||||
while True:
|
||||
data = await client.read(4096)
|
||||
writer.write(data.tobytes())
|
||||
await writer.drain()
|
||||
|
||||
|
||||
def parse_args():
|
||||
@@ -52,16 +52,16 @@ async def main(host):
|
||||
port = host[1]
|
||||
# Handle both IPv4 and IPv6 cases
|
||||
try:
|
||||
print("Try IPv4")
|
||||
reader, writer = await asyncio.open_connection(
|
||||
addr, port,
|
||||
)
|
||||
except:
|
||||
print("Try IPv6")
|
||||
reader, writer = await asyncio.open_connection(
|
||||
addr, port,
|
||||
family=socket.AF_INET6
|
||||
)
|
||||
print("Try IPv4")
|
||||
reader, writer = await asyncio.open_connection(
|
||||
addr, port,
|
||||
)
|
||||
except Exception:
|
||||
print("Try IPv6")
|
||||
reader, writer = await asyncio.open_connection(
|
||||
addr, port,
|
||||
family=socket.AF_INET6
|
||||
)
|
||||
|
||||
# Start TwoPartyClient using TwoWayPipe (takes no arguments in this mode)
|
||||
client = capnp.TwoPartyClient()
|
||||
|
||||
@@ -4,23 +4,22 @@ from __future__ import print_function
|
||||
import argparse
|
||||
import asyncio
|
||||
import socket
|
||||
import random
|
||||
import capnp
|
||||
|
||||
import calculator_capnp
|
||||
|
||||
|
||||
async def myreader(client, reader):
|
||||
while True:
|
||||
data = await reader.read(4096)
|
||||
await client.write(data)
|
||||
while True:
|
||||
data = await reader.read(4096)
|
||||
await client.write(data)
|
||||
|
||||
|
||||
async def mywriter(client, writer):
|
||||
while True:
|
||||
data = await client.read(4096)
|
||||
writer.write(data.tobytes())
|
||||
await writer.drain()
|
||||
while True:
|
||||
data = await client.read(4096)
|
||||
writer.write(data.tobytes())
|
||||
await writer.drain()
|
||||
|
||||
|
||||
def read_value(value):
|
||||
@@ -167,7 +166,7 @@ async def main():
|
||||
myserver,
|
||||
addr, port,
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
print("Try IPv6")
|
||||
server = await asyncio.start_server(
|
||||
myserver,
|
||||
|
||||
@@ -6,10 +6,10 @@ import asyncio
|
||||
import argparse
|
||||
import os
|
||||
import time
|
||||
import capnp
|
||||
import socket
|
||||
import ssl
|
||||
import time
|
||||
|
||||
import capnp
|
||||
|
||||
import thread_capnp
|
||||
|
||||
@@ -51,7 +51,6 @@ async def mywriter(client, writer):
|
||||
# to try again
|
||||
data = await asyncio.wait_for(client.read(4096), timeout=1.0)
|
||||
writer.write(data.tobytes())
|
||||
#await writer.drain()
|
||||
except asyncio.TimeoutError:
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user