Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • master
1 result

Target

Select target project
  • jirikalvoda/jr
1 result
Select Git revision
  • master
1 result
Show changes

Commits on Source 2

......@@ -55,7 +55,7 @@ class SSHRunSocket(Socket):
# eprint("READ END", r)
return r
class AsincioStreamSocket(Socket):
class AsyncioStreamSocket(Socket):
async def connect(self, reader, writer):
self.reader = reader
self.writer = writer
......@@ -70,12 +70,12 @@ class AsincioStreamSocket(Socket):
# eprint("STDIN READ END", r)
return r
class StdInOutSocket(AsincioStreamSocket):
class StdInOutSocket(AsyncioStreamSocket):
async def connect(self):
self.reader, self.writer = await connect_stdin_stdout()
return self
class UnixSocket(AsincioStreamSocket):
class UnixSocket(AsyncioStreamSocket):
async def connect(self, path):
self.reader, self.writer = await asyncio.open_unix_connection(path)
return self
......@@ -190,7 +190,7 @@ class FuncCaller:
async def _server_caller_(self, in_head, in_data_raw, connection_controll):
func_name = in_head["func_name"]
assert type(func_name) == str and func_name[0] != '_'
assert type(func_name) is str and func_name[0] != '_'
f = getattr(self, func_name)
in_data = cbor2.loads(in_data_raw)
r = await f(*in_data['args'], **in_data['kwargs'])
......
......@@ -12,13 +12,13 @@ _shape_matching_time = 0
async def unzip_parse(data):
if type(data) == dict:
if isinstance(data, dict):
assert len(data) == 1
data = list(data.values())[0]
if type(data) == bytes and data.startswith(b'\x1f\x8b'):
if isinstance(data, bytes) and data.startswith(b'\x1f\x8b'):
proc = await asyncio.create_subprocess_exec("gunzip", stdout=asyncio.subprocess.PIPE, stdin=asyncio.subprocess.PIPE)
data, stderr = await proc.communicate(data)
if type(data) == bytes and data.startswith(b'(\xb5/\xfd'):
if isinstance(data, bytes) and data.startswith(b'(\xb5/\xfd'):
proc = await asyncio.create_subprocess_exec("unzstd", stdout=asyncio.subprocess.PIPE, stdin=asyncio.subprocess.PIPE)
data, stderr = await proc.communicate(data)
return json.loads(data)
......
......@@ -112,7 +112,7 @@ class DownloadServer(communication.FuncCaller):
async def client_connected(reader, writer):
await catch_all(DownloadServer(await communication.AsincioStreamSocket().connect(reader, writer), is_server=True)._server_.run())
await catch_all(DownloadServer(await communication.AsyncioStreamSocket().connect(reader, writer), is_server=True)._server_.run())
async def main():
global caio_ctx
......
......@@ -167,7 +167,7 @@ async def main():
loaded_timestamps = []
async def client_connected(reader, writer):
s = PreprocessServer(await communication.AsincioStreamSocket().connect(reader, writer), is_server=True)
s = PreprocessServer(await communication.AsyncioStreamSocket().connect(reader, writer), is_server=True)
s.ths = ths
s.loaded_timestamps = loaded_timestamps
await catch_all(s._server_.run())
......