Skip to content

Commit

Permalink
ruff: enable TRY
Browse files Browse the repository at this point in the history
  • Loading branch information
adeebshihadeh committed May 21, 2024
1 parent b2e4c64 commit 0e3df5a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions system/webrtc/webrtcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ async def run(self):
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)


Expand Down Expand Up @@ -175,8 +175,8 @@ async def message_handler(self, message: bytes):
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:
Expand All @@ -200,8 +200,8 @@ async def run(self):
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()
Expand Down

0 comments on commit 0e3df5a

Please sign in to comment.