chore: set up ruff as a new linter/formatter (#28158)

This commit is contained in:
Maxime Beauchemin
2024-04-24 17:19:53 -07:00
committed by GitHub
parent e8a678b75a
commit 2d63722150
579 changed files with 2508 additions and 2542 deletions

View File

@@ -16,6 +16,7 @@
# under the License.
# isort:skip_file
"""Tests for security api methods"""
from unittest import mock
import pytest
@@ -26,8 +27,8 @@ from superset.models.dashboard import Dashboard
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.constants import ADMIN_USERNAME
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices,
load_birth_names_data,
load_birth_names_dashboard_with_slices, # noqa: F401
load_birth_names_data, # noqa: F401
)

View File

@@ -17,14 +17,14 @@
# isort:skip_file
import pytest
import tests.integration_tests.test_app # pylint: disable=unused-import
import tests.integration_tests.test_app # pylint: disable=unused-import # noqa: F401
from superset import db
from superset.daos.dashboard import EmbeddedDashboardDAO
from superset.models.dashboard import Dashboard
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.fixtures.world_bank_dashboard import (
load_world_bank_dashboard_with_slices,
load_world_bank_data,
load_world_bank_dashboard_with_slices, # noqa: F401
load_world_bank_data, # noqa: F401
)

View File

@@ -25,10 +25,10 @@ from superset import db
from superset.daos.dashboard import EmbeddedDashboardDAO
from superset.models.dashboard import Dashboard
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices,
load_birth_names_data,
load_birth_names_dashboard_with_slices, # noqa: F401
load_birth_names_data, # noqa: F401
)
from tests.integration_tests.fixtures.client import client
from tests.integration_tests.fixtures.client import client # noqa: F401
if TYPE_CHECKING:
from typing import Any
@@ -41,7 +41,7 @@ if TYPE_CHECKING:
"superset.extensions.feature_flag_manager._feature_flags",
EMBEDDED_SUPERSET=True,
)
def test_get_embedded_dashboard(client: FlaskClient[Any]):
def test_get_embedded_dashboard(client: FlaskClient[Any]): # noqa: F811
dash = db.session.query(Dashboard).filter_by(slug="births").first()
embedded = EmbeddedDashboardDAO.upsert(dash, [])
uri = f"embedded/{embedded.uuid}"
@@ -54,7 +54,7 @@ def test_get_embedded_dashboard(client: FlaskClient[Any]):
"superset.extensions.feature_flag_manager._feature_flags",
EMBEDDED_SUPERSET=True,
)
def test_get_embedded_dashboard_referrer_not_allowed(client: FlaskClient[Any]):
def test_get_embedded_dashboard_referrer_not_allowed(client: FlaskClient[Any]): # noqa: F811
dash = db.session.query(Dashboard).filter_by(slug="births").first()
embedded = EmbeddedDashboardDAO.upsert(dash, ["test.example.com"])
uri = f"embedded/{embedded.uuid}"
@@ -66,7 +66,7 @@ def test_get_embedded_dashboard_referrer_not_allowed(client: FlaskClient[Any]):
"superset.extensions.feature_flag_manager._feature_flags",
EMBEDDED_SUPERSET=True,
)
def test_get_embedded_dashboard_non_found(client: FlaskClient[Any]):
uri = f"embedded/bad-uuid"
def test_get_embedded_dashboard_non_found(client: FlaskClient[Any]): # noqa: F811
uri = "embedded/bad-uuid" # noqa: F541
response = client.get(uri)
assert response.status_code == 404