A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
chore(ruff): enable useless try-except check (#10621)
Shahmir Varqha4d64c39869dc
diff --git a/marimo/_ast/scanner.py b/marimo/_ast/scanner.pyindex dae9592c9b..20e9b182bc 100644--- a/marimo/_ast/scanner.py+++ b/marimo/_ast/scanner.py@@ -613,11 +613,8 @@ def scan_parse_fallback(# Preambleif scan.preamble.strip():- try:- tree = ast_parse(scan.preamble, filename=filepath)- nodes.extend(tree.body)- except SyntaxError:- raise # Preamble errors are fatal+ tree = ast_parse(scan.preamble, filename=filepath)+ nodes.extend(tree.body)# Cellsfor cell in scan.cells:diff --git a/marimo/_plugins/ui/_core/ui_element.py b/marimo/_plugins/ui/_core/ui_element.pyindex 1c75ad1c68..a887cd6f7a 100644--- a/marimo/_plugins/ui/_core/ui_element.py+++ b/marimo/_plugins/ui/_core/ui_element.py@@ -464,10 +464,7 @@ class UIElement(Html, Generic[S, T]):side-effect."""self._value_frontend = value- try:- self._value = self._convert_value(value)- except MarimoConvertValueException:- raise+ self._value = self._convert_value(value)if self._on_change is not None:self._on_change(self._value)diff --git a/marimo/_server/api/middleware.py b/marimo/_server/api/middleware.pyindex 50c0f8e6b5..8ffeffde05 100644--- a/marimo/_server/api/middleware.py+++ b/marimo/_server/api/middleware.py@@ -246,8 +246,6 @@ class _AsyncHTTPResponse:if not chunk:breakyield chunk- except Exception:- raisefinally:await self.aclose()@@ -327,17 +325,14 @@ class _AsyncHTTPClient:method = request.method or "GET"- try:- conn.request(- method=method,- url=path_and_query, # Only path and query- body=body,- headers=request.headers,- )- resp = conn.getresponse()- return resp # type: ignore[no-any-return]- except Exception:- raise+ conn.request(+ method=method,+ url=path_and_query, # Only path and query+ body=body,+ headers=request.headers,+ )+ resp = conn.getresponse()+ return resp # type: ignore[no-any-return]async def send(self, request: _URLRequest, stream: bool = False, max_retries: int = 2diff --git a/pyproject.toml b/pyproject.tomlindex 460eaa91b3..db7a0cb05f 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -382,7 +382,6 @@ ignore = ["DTZ012", # `date.fromtimestamp()` called without `tzinfo`"DTZ901", # `datetime.min` / `datetime.max` used"S112", # `try`-`except`-`continue`- "TRY203", # Useless `try`-`except`"PLC0105", # Type name incorrect variance"PLW1509", # `subprocess` `preexec_fn` argument"DTZ002", # `datetime.today()` called without tz