diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 67742cb727f9d..cd08edcf403ae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -75,7 +75,7 @@ repos: - id: helm-docs files: helm - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.0 + rev: v0.8.0 hooks: - id: ruff args: [ --fix ] diff --git a/pyproject.toml b/pyproject.toml index c905c4320beaa..65606953c8814 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -402,6 +402,7 @@ skipsdist = true [tool.ruff] # Exclude a variety of commonly ignored directories. exclude = [ + "**/*.ipynb", ".bzr", ".direnv", ".eggs", diff --git a/requirements/development.txt b/requirements/development.txt index 00aa0a9effb3f..0f4c3391d46cc 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -195,7 +195,7 @@ requests-oauthlib==2.0.0 # via google-auth-oauthlib rfc3339-validator==0.1.4 # via openapi-schema-validator -ruff==0.4.5 +ruff==0.8.0 # via apache-superset s3transfer==0.10.1 # via boto3 diff --git a/superset/extensions/metadb.py b/superset/extensions/metadb.py index b2d86149383cb..8424d8ee4ee8e 100644 --- a/superset/extensions/metadb.py +++ b/superset/extensions/metadb.py @@ -334,7 +334,9 @@ def _set_columns(self) -> None: primary_keys = [ column for column in list(self._table.primary_key) if column.primary_key ] - if len(primary_keys) == 1 and primary_keys[0].type.python_type == int: + if len(primary_keys) == 1 and isinstance( + primary_keys[0].type.python_type, type(int) + ): self._rowid = primary_keys[0].name self.columns = { diff --git a/tests/integration_tests/sqla_models_tests.py b/tests/integration_tests/sqla_models_tests.py index d4ca3bc1c1a47..2f22b92c5d292 100644 --- a/tests/integration_tests/sqla_models_tests.py +++ b/tests/integration_tests/sqla_models_tests.py @@ -1091,7 +1091,7 @@ def _convert_dttm( columns_by_name, ) - assert type(normalized) == type(result) + assert isinstance(normalized, type(result)) if isinstance(normalized, TextClause): assert str(normalized) == str(result) diff --git a/tests/integration_tests/viz_tests.py b/tests/integration_tests/viz_tests.py index 872c178bfa547..8403708a532ac 100644 --- a/tests/integration_tests/viz_tests.py +++ b/tests/integration_tests/viz_tests.py @@ -91,7 +91,7 @@ def test_get_df_returns_empty_df(self): datasource = self.get_datasource_mock() test_viz = viz.BaseViz(datasource, form_data) result = test_viz.get_df(query_obj) - assert type(result) == pd.DataFrame + assert isinstance(result, pd.DataFrame) assert result.empty def test_get_df_handles_dttm_col(self): diff --git a/tests/unit_tests/dao/key_value_test.py b/tests/unit_tests/dao/key_value_test.py index 18c0dfb25f946..abe05f8777b18 100644 --- a/tests/unit_tests/dao/key_value_test.py +++ b/tests/unit_tests/dao/key_value_test.py @@ -143,7 +143,7 @@ def test_create_pickle_entry( found_entry = ( db.session.query(KeyValueEntry).filter_by(id=created_entry.id).one() ) - assert type(pickle.loads(found_entry.value)) == type(PICKLE_VALUE) + assert isinstance(pickle.loads(found_entry.value), type(PICKLE_VALUE)) assert found_entry.created_by_fk == admin_user.id