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 single-item membership checks (#10805)
Shahmir Varqhaf99bee5bc98c
diff --git a/marimo/_ast/scanner.py b/marimo/_ast/scanner.pyindex 20e9b182bc..c5f76494f2 100644--- a/marimo/_ast/scanner.py+++ b/marimo/_ast/scanner.py@@ -375,7 +375,7 @@ def _extract_name_from_cell(end_0: int,) -> str | None:"""Extract the function/class name from lines following a decorator."""- if kind in ("setup",):+ if kind == "setup":return Noneif kind == "unparsable":# For unparsable cells, try to find `name="..."` in the calldiff --git a/marimo/_save/loaders/lazy.py b/marimo/_save/loaders/lazy.pyindex 40376f02df..17e4e6ec41 100644--- a/marimo/_save/loaders/lazy.py+++ b/marimo/_save/loaders/lazy.py@@ -1389,7 +1389,7 @@ class LazyLoader(BasePersistenceLoader):if loader == "ui":ui_vars[var] = objui_defs_list.append(var)- elif loader not in ("inline",):+ elif loader != "inline":format_vars.setdefault(loader, {})[var] = objversion = cache.meta.get("version", MARIMO_CACHE_VERSION)diff --git a/pyproject.toml b/pyproject.tomlindex 297fc02ccf..9190f83a45 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -391,7 +391,6 @@ ignore = ["FURB110", # Replace ternary with an `or` expression"RUF036", # `None` is not last in a union"FURB113", # Repeated `append` calls- "FURB171", # Single-item membership test"NPY002", # Legacy NumPy random API"RUF100", # Unused `noqa` directive]diff --git a/tests/_plugins/ui/_impl/dataframes/test_print_code.py b/tests/_plugins/ui/_impl/dataframes/test_print_code.pyindex ccaa1c3ba3..d5207939f5 100644--- a/tests/_plugins/ui/_impl/dataframes/test_print_code.py+++ b/tests/_plugins/ui/_impl/dataframes/test_print_code.py@@ -810,7 +810,7 @@ def test_print_code_result_matches_actual_transform_polars(# while narwhals uses Python's str() which gives True/Falseassume(not any(- column_id in {"booleans"} for column_id in transform.column_ids+ column_id == "booleans" for column_id in transform.column_ids))# When value_column_ids is empty, all remaining columns become values.@@ -1075,7 +1075,7 @@ def test_print_code_result_matches_actual_transform_ibis(if transform.type == TransformType.FILTER_ROWS:assume(not any(- condition.column_id in {"booleans"}+ condition.column_id == "booleans"for condition in transform.where.children))diff --git a/tests/_save/test_cache.py b/tests/_save/test_cache.pyindex 87d1072d6d..3b2f2c80dc 100644--- a/tests/_save/test_cache.py+++ b/tests/_save/test_cache.py@@ -1980,7 +1980,7 @@ class TestCacheDecorator:assert not k.stdout.messages, k.stdout# Throw a warning for flake edge case where cache is evicted earlier# than expected.- if k.globals["fib"].hits in (10,):+ if k.globals["fib"].hits == 10:warnings.warn("Known flaky edge case for cache rerun.", stacklevel=1)diff --git a/tests/_save/test_hash.py b/tests/_save/test_hash.pyindex 88567b80f5..d1a6a7017f 100644--- a/tests/_save/test_hash.py+++ b/tests/_save/test_hash.py@@ -2635,7 +2635,8 @@ class TestSetLiteralDeterminism:from marimo._save.hash import hash_moduledef fn(x: object) -> bool:- return x in {"A"}+ # Keep the singleton set: this test inspects its frozenset constant.+ return x in {"A"} # noqa: FURB171code = fn.__code__singleton = next(c for c in code.co_consts if isinstance(c, frozenset))