From cda384fb933d6a9f92fb3333771b909e53de0d34 Mon Sep 17 00:00:00 2001 From: Florian Maas Date: Tue, 16 Jul 2024 19:50:55 +0200 Subject: [PATCH 1/2] Enable RUF ruleset for ruff --- python/deltalake/table.py | 2 +- python/deltalake/writer.py | 2 +- python/pyproject.toml | 4 +++- python/tests/pyspark_integration/test_write_to_pyspark.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/python/deltalake/table.py b/python/deltalake/table.py index 14ffd3f6f9..a85a31bf0b 100644 --- a/python/deltalake/table.py +++ b/python/deltalake/table.py @@ -49,7 +49,7 @@ from deltalake.schema import Schema as DeltaSchema try: - import pandas as pd # noqa: F811 + import pandas as pd except ModuleNotFoundError: _has_pandas = False else: diff --git a/python/deltalake/writer.py b/python/deltalake/writer.py index e435dea10a..8b1705f1fd 100644 --- a/python/deltalake/writer.py +++ b/python/deltalake/writer.py @@ -60,7 +60,7 @@ ) try: - import pandas as pd # noqa: F811 + import pandas as pd except ModuleNotFoundError: _has_pandas = False else: diff --git a/python/pyproject.toml b/python/pyproject.toml index dd69669335..3d1c8f72ad 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -83,7 +83,9 @@ select = [ # pyflakes "F", # isort - "I" + "I", + # ruff + "RUF" ] ignore = ["E501"] diff --git a/python/tests/pyspark_integration/test_write_to_pyspark.py b/python/tests/pyspark_integration/test_write_to_pyspark.py index 3e4bb9d7f0..81cda71883 100644 --- a/python/tests/pyspark_integration/test_write_to_pyspark.py +++ b/python/tests/pyspark_integration/test_write_to_pyspark.py @@ -106,7 +106,7 @@ def test_checks_min_writer_version(tmp_path: pathlib.Path): ) # Add a constraint upgrades the minWriterProtocol - spark.sql(f"ALTER TABLE delta.`{str(tmp_path)}` ADD CONSTRAINT x CHECK (c1 > 2)") + spark.sql(f"ALTER TABLE delta.`{tmp_path!s}` ADD CONSTRAINT x CHECK (c1 > 2)") with pytest.raises( DeltaProtocolError, match="This table's min_writer_version is 3, but" From 8d19a087df97e519670a100efd6990a5adb99044 Mon Sep 17 00:00:00 2001 From: Florian Maas Date: Tue, 16 Jul 2024 19:52:56 +0200 Subject: [PATCH 2/2] better description --- python/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyproject.toml b/python/pyproject.toml index 3d1c8f72ad..c02b341dba 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -84,7 +84,7 @@ select = [ "F", # isort "I", - # ruff + # ruff-specific rules "RUF" ] ignore = ["E501"]