Skip to content

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.

fix pre-commit false-positives (#8106)

Shahmir Varqhaf9f7698f2b72
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 5165cebecc..7cb2bcdfc4 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -13,7 +13,7 @@ repos:
args: [-ignore, SC]
- repo: https://github.com/abravalheri/validate-pyproject
- rev: v0.24.1
+ rev: v0.25
hooks:
- id: validate-pyproject
@@ -25,13 +25,13 @@ repos:
exclude: ^marimo/_tutorials/.*\.md
- repo: https://github.com/crate-ci/typos
- rev: v1
+ rev: v1.43.1
hooks:
- id: typos
pass_filenames: false
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.14.13
+ rev: v0.15.0
hooks:
# Run the linter
- id: ruff
diff --git a/marimo/_plugins/ui/_impl/dataframes/transforms/handlers.py b/marimo/_plugins/ui/_impl/dataframes/transforms/handlers.py
index 6e5ef748bb..69b4f34717 100644
--- a/marimo/_plugins/ui/_impl/dataframes/transforms/handlers.py
+++ b/marimo/_plugins/ui/_impl/dataframes/transforms/handlers.py
@@ -387,8 +387,10 @@ class NarwhalsTransformHandler(TransformHandler[DataFrame]):
if not transform.index_column_ids:
index_columns = list(
filter(
- lambda col: col not in transform.column_ids
- and col not in transform.value_column_ids,
+ lambda col: (
+ col not in transform.column_ids
+ and col not in transform.value_column_ids
+ ),
columns,
)
)
@@ -398,8 +400,10 @@ class NarwhalsTransformHandler(TransformHandler[DataFrame]):
if not transform.value_column_ids:
value_columns = list(
filter(
- lambda col: col not in transform.column_ids
- and col not in transform.index_column_ids,
+ lambda col: (
+ col not in transform.column_ids
+ and col not in transform.index_column_ids
+ ),
columns,
)
)
diff --git a/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py b/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py
index 9e0ed11b8f..a63fd2b738 100644
--- a/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py
+++ b/marimo/_plugins/ui/_impl/dataframes/transforms/print_code.py
@@ -222,8 +222,10 @@ def python_print_pandas(
index_columns = _list_of_strings(
list(
filter(
- lambda col: col not in transform.column_ids
- and col not in transform.value_column_ids,
+ lambda col: (
+ col not in transform.column_ids
+ and col not in transform.value_column_ids
+ ),
all_columns,
)
)
@@ -235,8 +237,10 @@ def python_print_pandas(
value_columns = _list_of_strings(
list(
filter(
- lambda col: col not in transform.column_ids
- and col not in transform.index_column_ids,
+ lambda col: (
+ col not in transform.column_ids
+ and col not in transform.index_column_ids
+ ),
all_columns,
)
)
@@ -440,8 +444,10 @@ def python_print_polars(
index_column_ids = _list_of_strings(
list(
filter(
- lambda col: col not in transform.column_ids
- and col not in transform.value_column_ids,
+ lambda col: (
+ col not in transform.column_ids
+ and col not in transform.value_column_ids
+ ),
all_columns,
)
)
@@ -453,8 +459,10 @@ def python_print_polars(
value_column_ids = _list_of_strings(
list(
filter(
- lambda col: col not in transform.column_ids
- and col not in transform.index_column_ids,
+ lambda col: (
+ col not in transform.column_ids
+ and col not in transform.index_column_ids
+ ),
all_columns,
)
)
@@ -623,8 +631,10 @@ def python_print_ibis(
index_column_ids = _list_of_strings(
list(
filter(
- lambda col: col not in transform.column_ids
- and col not in transform.value_column_ids,
+ lambda col: (
+ col not in transform.column_ids
+ and col not in transform.value_column_ids
+ ),
all_columns,
)
)
@@ -636,8 +646,10 @@ def python_print_ibis(
value_column_ids = _list_of_strings(
list(
filter(
- lambda col: col not in transform.column_ids
- and col not in transform.index_column_ids,
+ lambda col: (
+ col not in transform.column_ids
+ and col not in transform.index_column_ids
+ ),
all_columns,
)
)
diff --git a/pyproject.toml b/pyproject.toml
index 1b19ca6902..6f5c960957 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -552,6 +552,7 @@ extend-exclude = [
"base64.test.ts",
"SECURITY.md", # Contains usernames that trigger typos
"patches/*", # Patches may contain typos from source code
+ "tests/_sql/test_sql_parse.py", # Contains intentional invalid SQL for testing
]
[tool.black]
diff --git a/tests/_plugins/ui/_impl/tables/test_polars_table.py b/tests/_plugins/ui/_impl/tables/test_polars_table.py
index baf4322b6c..677c42c61f 100644
--- a/tests/_plugins/ui/_impl/tables/test_polars_table.py
+++ b/tests/_plugins/ui/_impl/tables/test_polars_table.py
@@ -799,9 +799,9 @@ class TestPolarsTableManagerFactory(unittest.TestCase):
"integers": lambda x: -100 if x is None else x * 2,
"floats": lambda x: "---" if x is None else f"{x:.1f}",
"booleans": lambda x: "MISSING" if x is None else str(x).upper(),
- "dates": lambda x: "No Date"
- if x is None
- else x.strftime("%Y-%m-%d"),
+ "dates": lambda x: (
+ "No Date" if x is None else x.strftime("%Y-%m-%d")
+ ),
"lists": lambda x: "Empty" if x is None else f"List({len(x)})",
}
diff --git a/tests/_runtime/test_complete.py b/tests/_runtime/test_complete.py
index 151c0ef49a..abde7d9791 100644
--- a/tests/_runtime/test_complete.py
+++ b/tests/_runtime/test_complete.py
@@ -176,9 +176,11 @@ def dummy_func(arg1: str, arg2: str) -> None:
[marimo.accordion, True],
[dummy_func, False],
],
- ids=lambda obj: f"{obj}"
- if isinstance(obj, bool)
- else f"{obj.__module__}.{obj.__qualname__}",
+ ids=lambda obj: (
+ f"{obj}"
+ if isinstance(obj, bool)
+ else f"{obj.__module__}.{obj.__qualname__}"
+ ),
)
def test_parameter_descriptions(obj: Any, runtime_inference: bool):
patch_jedi_parameter_completion()
diff --git a/tests/_runtime/test_manage_script_metadata.py b/tests/_runtime/test_manage_script_metadata.py
index c0a8798508..d8a1332089 100644
--- a/tests/_runtime/test_manage_script_metadata.py
+++ b/tests/_runtime/test_manage_script_metadata.py
@@ -640,8 +640,8 @@ async def test_install_missing_packages_streaming_logs_multiple_packages(
mock_package_manager.name = "pip"
mock_package_manager.is_manager_installed.return_value = True
mock_package_manager.attempted_to_install.return_value = False
- mock_package_manager.package_to_module.side_effect = (
- lambda pkg: pkg.replace("-", "_")
+ mock_package_manager.package_to_module.side_effect = lambda pkg: (
+ pkg.replace("-", "_")
)
# Track which packages are being installed