ruff: enable TRY

old-commit-hash: 0e3df5ae4d673c3644f04861a73e3aa599dd03ae
This commit is contained in:
Adeeb Shihadeh
2024-05-20 17:47:48 -07:00
parent 3358745103
commit 70d14c99e1
2 changed files with 14 additions and 7 deletions
+8 -1
View File
@@ -184,7 +184,14 @@ build-backend = "poetry.core.masonry.api"
# https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml
[tool.ruff]
indent-width = 2
lint.select = ["E", "F", "W", "PIE", "C4", "ISC", "NPY", "UP", "RUF008", "RUF100", "A", "B", "TID251"]
lint.select = [
"E", "F", "W", "PIE", "C4", "ISC", "A", "B",
"NPY", # numpy
"UP", # pyupgrade
"TRY302", "TRY400", "TRY401", # try/excepts
"RUF008", "RUF100",
"TID251"
]
lint.ignore = [
"E741",
"E402",
+6 -6
View File
@@ -97,8 +97,8 @@ class CerealProxyRunner:
except InvalidStateError:
self.logger.warning("Cereal outgoing proxy invalid state (connection closed)")
break
except Exception as ex:
self.logger.error("Cereal outgoing proxy failure: %s", ex)
except Exception:
self.logger.exception("Cereal outgoing proxy failure")
await asyncio.sleep(0.01)
@@ -175,8 +175,8 @@ class StreamSession:
assert self.incoming_bridge is not None
try:
self.incoming_bridge.send(message)
except Exception as ex:
self.logger.error("Cereal incoming proxy failure: %s", ex)
except Exception:
self.logger.exception("Cereal incoming proxy failure")
async def run(self):
try:
@@ -200,8 +200,8 @@ class StreamSession:
await self.post_run_cleanup()
self.logger.info("Stream session (%s) ended", self.identifier)
except Exception as ex:
self.logger.error("Stream session failure: %s", ex)
except Exception:
self.logger.exception("Stream session failure")
async def post_run_cleanup(self):
await self.stream.stop()