diff --git a/prog/communication.py b/prog/communication.py index bfcb63b810d87f2f32e1ac4000a4713776771e8c..e0b37dbd417f900d348ddb3a95a1bd1c57e86f53 100644 --- a/prog/communication.py +++ b/prog/communication.py @@ -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']) diff --git a/prog/data_utils.py b/prog/data_utils.py index 2789c13d8f6f1a7bde0b1906051dc549e35b63d7..525bc135688184c2406dab8df19d4151de4e7b98 100644 --- a/prog/data_utils.py +++ b/prog/data_utils.py @@ -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)