Skip to content
Snippets Groups Projects
Commit 7aa506d5 authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

type(A) == X -> isinstance(A, X)

parent b7f1a824
Branches
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment