Skip to content

Commit

Permalink
remove F401 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
eschutho committed Feb 6, 2025
1 parent 9e5876d commit 2744ab8
Show file tree
Hide file tree
Showing 78 changed files with 3 additions and 127 deletions.
1 change: 0 additions & 1 deletion superset/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
security_manager, # noqa: F401
talisman, # noqa: F401
)
from superset.security import SupersetSecurityManager # noqa: F401

# All of the fields located here should be considered legacy. The correct way
# to declare "global" dependencies is to define it in extensions.py,
Expand Down
1 change: 0 additions & 1 deletion superset/commands/chart/importers/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from typing import Any

from marshmallow import Schema
from sqlalchemy.orm import Session # noqa: F401

from superset.charts.schemas import ImportV1ChartSchema
from superset.commands.chart.exceptions import ChartImportError
Expand Down
1 change: 0 additions & 1 deletion superset/commands/dashboard/importers/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from typing import Any

from marshmallow import Schema
from sqlalchemy.orm import Session # noqa: F401
from sqlalchemy.sql import select

from superset import db
Expand Down
1 change: 0 additions & 1 deletion superset/commands/database/importers/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from typing import Any

from marshmallow import Schema
from sqlalchemy.orm import Session # noqa: F401

from superset.commands.database.exceptions import DatabaseImportError
from superset.commands.database.importers.v1.utils import import_database
Expand Down
1 change: 0 additions & 1 deletion superset/commands/dataset/importers/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from typing import Any

from marshmallow import Schema
from sqlalchemy.orm import Session # noqa: F401

from superset.commands.database.importers.v1.utils import import_database
from superset.commands.dataset.exceptions import DatasetImportError
Expand Down
2 changes: 0 additions & 2 deletions superset/commands/importers/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

from marshmallow import Schema, validate # noqa: F401
from marshmallow.exceptions import ValidationError
from sqlalchemy.orm import Session # noqa: F401

from superset import db
from superset.commands.base import BaseCommand
Expand All @@ -31,7 +30,6 @@
validate_metadata_type,
)
from superset.daos.base import BaseDAO
from superset.models.core import Database # noqa: F401
from superset.utils.decorators import transaction


Expand Down
2 changes: 0 additions & 2 deletions superset/commands/query/importers/v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
from typing import Any

from marshmallow import Schema
from sqlalchemy.orm import Session # noqa: F401

from superset.commands.database.importers.v1.utils import import_database
from superset.commands.importers.v1 import ImportModelsCommand
from superset.commands.query.exceptions import SavedQueryImportError
from superset.commands.query.importers.v1.utils import import_saved_query
from superset.connectors.sqla.models import SqlaTable # noqa: F401
from superset.daos.query import SavedQueryDAO
from superset.databases.schemas import ImportV1DatabaseSchema
from superset.queries.saved_queries.schemas import ImportV1SavedQuerySchema
Expand Down
2 changes: 1 addition & 1 deletion superset/initialization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
stats_logger_manager,
talisman,
)
from superset.security import SupersetSecurityManager
from superset.security.manager import SupersetSecurityManager
from superset.sql.parse import SQLGLOT_DIALECTS
from superset.superset_typing import FlaskResponse
from superset.tags.core import register_sqla_event_listeners
Expand Down
3 changes: 0 additions & 3 deletions superset/reports/notifications/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
# under the License.
from superset.reports.models import ReportRecipients
from superset.reports.notifications.base import BaseNotification, NotificationContent
from superset.reports.notifications.email import EmailNotification # noqa: F401
from superset.reports.notifications.slack import SlackNotification # noqa: F401
from superset.reports.notifications.slackv2 import SlackV2Notification # noqa: F401


def create_notification(
Expand Down
1 change: 0 additions & 1 deletion superset/security/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from superset.security.manager import SupersetSecurityManager # noqa: F401
1 change: 0 additions & 1 deletion superset/sql_validators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from typing import Optional

from . import base, postgres, presto_db
from .base import SQLValidationAnnotation # noqa: F401


def get_validator_by_name(name: str) -> Optional[type[base.BaseSQLValidator]]:
Expand Down
3 changes: 0 additions & 3 deletions tests/integration_tests/access_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import pytest
from flask.ctx import AppContext
from pytest_mock import MockerFixture
from sqlalchemy import inspect # noqa: F401

from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, # noqa: F401
Expand All @@ -38,10 +37,8 @@
load_energy_table_data, # noqa: F401
)
from superset import security_manager
from superset.connectors.sqla.models import SqlaTable # noqa: F401
from superset.models import core as models # noqa: F401
from superset.utils.core import get_user_id, get_username, override_user
from superset.utils.database import get_example_database # noqa: F401


ROLE_TABLES_PERM_DATA = {
Expand Down
4 changes: 0 additions & 4 deletions tests/integration_tests/advanced_data_type/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
"""Unit tests for Superset"""

import prison

from superset.utils.core import get_example_default_schema # noqa: F401

from tests.integration_tests.utils.get_dashboards import get_dashboards_ids # noqa: F401
from unittest import mock
from sqlalchemy import Column
from typing import Any
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/charts/commands_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import pytest
import yaml
from flask import g # noqa: F401

from superset import db, security_manager
from superset.commands.chart.create import CreateChartCommand
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/css_templates/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import tests.integration_tests.test_app # noqa: F401
from superset import db
from superset.models.core import CssTemplate
from superset.utils.database import get_example_database # noqa: F401
from superset.utils import json

from tests.integration_tests.base_tests import SupersetTestCase
Expand Down
2 changes: 0 additions & 2 deletions tests/integration_tests/dashboard_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

from typing import Optional

from pandas import DataFrame # noqa: F401

from superset import db
from superset.connectors.sqla.models import SqlaTable
from superset.models.core import Database
Expand Down
3 changes: 0 additions & 3 deletions tests/integration_tests/dashboards/filter_state/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from unittest.mock import patch # noqa: F401

import pytest
from flask.ctx import AppContext
from flask_appbuilder.security.sqla.models import User
from sqlalchemy.orm import Session # noqa: F401

from superset import db
from superset.commands.dashboard.exceptions import (
Expand All @@ -34,7 +32,6 @@
load_world_bank_dashboard_with_slices, # noqa: F401
load_world_bank_data, # noqa: F401
)
from tests.integration_tests.test_app import app # noqa: F401

KEY = "test-key"
INITIAL_VALUE = json.dumps({"test": "initial value"})
Expand Down
2 changes: 0 additions & 2 deletions tests/integration_tests/dashboards/permalink/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import pytest
from flask_appbuilder.security.sqla.models import User # noqa: F401
from sqlalchemy.orm import Session # noqa: F401

from superset import db
from superset.commands.dashboard.exceptions import (
Expand All @@ -34,7 +33,6 @@
load_world_bank_dashboard_with_slices, # noqa: F401
load_world_bank_data, # noqa: F401
)
from tests.integration_tests.test_app import app # noqa: F401

STATE = {
"dataMask": {"FILTER_1": "foo"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import prison
import pytest
from flask import escape # noqa: F401

from superset import app
from superset.daos.dashboard import DashboardDAO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"""Unit tests for Superset"""

from unittest import mock
from unittest.mock import patch # noqa: F401

import pytest

Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/databases/commands_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
from superset.commands.exceptions import CommandInvalidError
from superset.commands.importers.exceptions import IncorrectVersionError
from superset.connectors.sqla.models import SqlaTable
from superset.databases.schemas import DatabaseTestConnectionSchema # noqa: F401
from superset.databases.ssh_tunnel.models import SSHTunnel
from superset.errors import ErrorLevel, SupersetError, SupersetErrorType
from superset.exceptions import (
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/datasets/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from sqlalchemy.orm import joinedload
from sqlalchemy.sql import func

from superset import app # noqa: F401
from superset.commands.dataset.exceptions import DatasetCreateFailedError
from superset.connectors.sqla.models import SqlaTable, SqlMetric, TableColumn
from superset.extensions import db, security_manager
Expand Down
2 changes: 0 additions & 2 deletions tests/integration_tests/db_engine_specs/base_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# specific language governing permissions and limitations
# under the License.
# isort:skip_file

from tests.integration_tests.test_app import app # noqa: F401
from tests.integration_tests.base_tests import SupersetTestCase
from superset.db_engine_specs.base import BaseEngineSpec
from superset.models.core import Database
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/db_engine_specs/presto_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import pandas as pd
from flask.ctx import AppContext
from sqlalchemy import types # noqa: F401
from sqlalchemy.sql import select

from superset.db_engine_specs.presto import PrestoEngineSpec
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/event_logger_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from typing import Any, Optional
from unittest.mock import patch

from flask import current_app # noqa: F401
from freezegun import freeze_time

from superset import security_manager
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/explore/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import pytest
from flask_appbuilder.security.sqla.models import User
from sqlalchemy.orm import Session # noqa: F401

from superset import db
from superset.commands.explore.form_data.state import TemporaryExploreState
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/explore/form_data/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import pytest
from flask_appbuilder.security.sqla.models import User
from sqlalchemy.orm import Session # noqa: F401

from superset import db
from superset.commands.dataset.exceptions import DatasetAccessDeniedError
Expand Down
2 changes: 0 additions & 2 deletions tests/integration_tests/explore/permalink/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from uuid import uuid3

import pytest
from sqlalchemy.orm import Session # noqa: F401

from superset import db
from superset.explore.permalink.schemas import ExplorePermalinkSchema
Expand All @@ -33,7 +32,6 @@
load_world_bank_dashboard_with_slices, # noqa: F401
load_world_bank_data, # noqa: F401
)
from tests.integration_tests.test_app import app # noqa: F401


@pytest.fixture
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/fixtures/datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from superset.extensions import db
from superset.models.core import Database
from superset.utils.core import get_example_default_schema
from superset.utils.database import get_example_database # noqa: F401
from tests.integration_tests.test_app import app


Expand Down
2 changes: 0 additions & 2 deletions tests/integration_tests/log_api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@
from superset.views.log.api import LogRestApi
from superset.utils import json
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.conftest import with_feature_flags # noqa: F401
from tests.integration_tests.constants import (
ADMIN_USERNAME,
ALPHA_USERNAME,
GAMMA_USERNAME,
)
from tests.integration_tests.dashboard_utils import create_dashboard
from tests.integration_tests.test_app import app # noqa: F401

EXPECTED_COLUMNS = [
"action",
Expand Down
3 changes: 0 additions & 3 deletions tests/integration_tests/model_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from unittest import mock

from superset import security_manager
from superset.connectors.sqla.models import SqlaTable # noqa: F401
from superset.exceptions import SupersetException
from superset.utils.core import override_user
from tests.integration_tests.fixtures.birth_names_dashboard import (
Expand All @@ -32,11 +31,9 @@

import pytest
from sqlalchemy.engine.url import make_url
from sqlalchemy.types import DateTime # noqa: F401

import tests.integration_tests.test_app # noqa: F401
from superset import app, db as metadata_db
from superset.db_engine_specs.postgres import PostgresEngineSpec # noqa: F401
from superset.common.db_query_status import QueryStatus
from superset.models.core import Database
from superset.models.slice import Slice
Expand Down
4 changes: 0 additions & 4 deletions tests/integration_tests/reports/commands_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1756,7 +1756,6 @@ def test_email_dashboard_report_fails_uncaught_exception(
and logs with uncaught exception
"""
# setup screenshot mock
from smtplib import SMTPException # noqa: F401

screenshot_mock.return_value = SCREENSHOT_FILE
email_mock.side_effect = Exception("Uncaught exception")
Expand Down Expand Up @@ -2045,9 +2044,6 @@ def test_fail_screenshot(screenshot_mock, email_mock, create_report_email_chart)
"""
ExecuteReport Command: Test soft timeout on screenshot
"""
from celery.exceptions import SoftTimeLimitExceeded # noqa: F401

from superset.commands.report.exceptions import AlertQueryTimeout # noqa: F401

screenshot_mock.side_effect = Exception("Unexpected error")
with pytest.raises(ReportScheduleScreenshotFailedError):
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/reports/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
)
from superset.utils import json
from superset.utils.core import override_user
from tests.integration_tests.test_app import app # noqa: F401
from tests.integration_tests.utils import read_fixture

TEST_ID = str(uuid4())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
from superset.daos.dashboard import EmbeddedDashboardDAO
from superset.exceptions import SupersetSecurityException
from superset.models.dashboard import Dashboard
from superset.security.guest_token import GuestTokenResourceType # noqa: F401
from superset.sql_parse import Table # noqa: F401
from superset.security.guest_token import GuestTokenResourceType
from superset.utils import json
from superset.utils.core import get_example_default_schema
from superset.utils.database import get_example_database
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/security/migrate_roles_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import logging
from contextlib import contextmanager
from unittest.mock import patch # noqa: F401

import pytest
from flask_appbuilder.security.sqla.models import Role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
from flask_babel import lazy_gettext as _ # noqa: F401
from flask_appbuilder.models.sqla import filters
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.conftest import with_config # noqa: F401
from tests.integration_tests.constants import ADMIN_USERNAME
from tests.integration_tests.fixtures.birth_names_dashboard import (
load_birth_names_dashboard_with_slices, # noqa: F401
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/security_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

from flask import current_app, g
from flask_appbuilder.security.sqla.models import Role
from superset.daos.datasource import DatasourceDAO # noqa: F401
from superset.models.dashboard import Dashboard
from superset import app, appbuilder, db, security_manager, viz
from superset.connectors.sqla.models import SqlaTable
Expand Down
Loading

0 comments on commit 2744ab8

Please sign in to comment.