mirror of
https://github.com/capnproto/pycapnp.git
synced 2025-03-04 08:24:43 +01:00
Fixing flake8 linting errors
This commit is contained in:
parent
0e830c2127
commit
7789ebbf96
5 changed files with 27 additions and 32 deletions
|
@ -4,7 +4,6 @@ import subprocess
|
|||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
def build_libcapnp(bundle_dir, build_dir, verbose=False):
|
||||
'''
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import gc
|
||||
import os
|
||||
import socket
|
||||
import subprocess
|
||||
import sys # add examples dir to sys.path
|
||||
import time
|
||||
|
||||
examples_dir = os.path.join(os.path.dirname(__file__), '..', 'examples')
|
||||
|
|
Loading…
Add table
Reference in a new issue