pass keyword is just useless by design. There鈥檚 no usecase for it.
What about when you need to ignore an error and need the else block?
while True:
try:
vehicle_data = await v.get_data()
except VehicleUnavailableError:
pass
else:
msg = {"user": user, "type": "vehicle_data", "data": vehicle_data}
await self._queue.put(msg)
await asyncio.sleep(interval)
To rewrite this with suppress() would require moving the else block into the with block, which would seem to go against the idea behind WPS 229.
I would use with suppress(VehicleUnavailableError): here.
This should probably be closed, but I just wanted to contribute a bit. I think the purpose of WPS229 is to avoid issues with the very general exceptions that could crop up almost anywhere (KeyError, ValueError, etc). Custom exceptions generally have lower coverage on where and how they can be thrown. I'd argue (if there isn't already) that there should be a rule disallowing suppression of base Errors. Though, someone could probably argue a valid use case.
Thanks!
@Sxderp we have several of quite valid cases right in the source code of wps (I guess).