mirror of
https://github.com/apache/superset.git
synced 2026-04-18 23:55:00 +00:00
chore(pre-commit): Add pyupgrade and pycln hooks (#24197)
This commit is contained in:
@@ -14,8 +14,6 @@
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
|
||||
import pytest
|
||||
import pytz
|
||||
@@ -49,7 +47,7 @@ from superset.tasks.cron_util import cron_schedule_window
|
||||
],
|
||||
)
|
||||
def test_cron_schedule_window_los_angeles(
|
||||
current_dttm: str, cron: str, expected: List[FakeDatetime]
|
||||
current_dttm: str, cron: str, expected: list[FakeDatetime]
|
||||
) -> None:
|
||||
"""
|
||||
Reports scheduler: Test cron schedule window for "America/Los_Angeles"
|
||||
@@ -86,7 +84,7 @@ def test_cron_schedule_window_los_angeles(
|
||||
],
|
||||
)
|
||||
def test_cron_schedule_window_invalid_timezone(
|
||||
current_dttm: str, cron: str, expected: List[FakeDatetime]
|
||||
current_dttm: str, cron: str, expected: list[FakeDatetime]
|
||||
) -> None:
|
||||
"""
|
||||
Reports scheduler: Test cron schedule window for "invalid timezone"
|
||||
@@ -124,7 +122,7 @@ def test_cron_schedule_window_invalid_timezone(
|
||||
],
|
||||
)
|
||||
def test_cron_schedule_window_new_york(
|
||||
current_dttm: str, cron: str, expected: List[FakeDatetime]
|
||||
current_dttm: str, cron: str, expected: list[FakeDatetime]
|
||||
) -> None:
|
||||
"""
|
||||
Reports scheduler: Test cron schedule window for "America/New_York"
|
||||
@@ -161,7 +159,7 @@ def test_cron_schedule_window_new_york(
|
||||
],
|
||||
)
|
||||
def test_cron_schedule_window_chicago(
|
||||
current_dttm: str, cron: str, expected: List[FakeDatetime]
|
||||
current_dttm: str, cron: str, expected: list[FakeDatetime]
|
||||
) -> None:
|
||||
"""
|
||||
Reports scheduler: Test cron schedule window for "America/Chicago"
|
||||
@@ -198,7 +196,7 @@ def test_cron_schedule_window_chicago(
|
||||
],
|
||||
)
|
||||
def test_cron_schedule_window_chicago_daylight(
|
||||
current_dttm: str, cron: str, expected: List[FakeDatetime]
|
||||
current_dttm: str, cron: str, expected: list[FakeDatetime]
|
||||
) -> None:
|
||||
"""
|
||||
Reports scheduler: Test cron schedule window for "America/Chicago"
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
from contextlib import nullcontext
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from typing import Any, Dict, List, Optional, Tuple, Type, Union
|
||||
from typing import Any, Optional, Union
|
||||
|
||||
import pytest
|
||||
from flask_appbuilder.security.sqla.models import User
|
||||
@@ -31,8 +31,8 @@ SELENIUM_USERNAME = "admin"
|
||||
|
||||
|
||||
def _get_users(
|
||||
params: Optional[Union[int, List[int]]]
|
||||
) -> Optional[Union[User, List[User]]]:
|
||||
params: Optional[Union[int, list[int]]]
|
||||
) -> Optional[Union[User, list[User]]]:
|
||||
if params is None:
|
||||
return None
|
||||
if isinstance(params, int):
|
||||
@@ -42,7 +42,7 @@ def _get_users(
|
||||
|
||||
@dataclass
|
||||
class ModelConfig:
|
||||
owners: List[int]
|
||||
owners: list[int]
|
||||
creator: Optional[int] = None
|
||||
modifier: Optional[int] = None
|
||||
|
||||
@@ -268,18 +268,18 @@ class ModelType(int, Enum):
|
||||
)
|
||||
def test_get_executor(
|
||||
model_type: ModelType,
|
||||
executor_types: List[ExecutorType],
|
||||
executor_types: list[ExecutorType],
|
||||
model_config: ModelConfig,
|
||||
current_user: Optional[int],
|
||||
expected_result: Tuple[int, ExecutorNotFoundError],
|
||||
expected_result: tuple[int, ExecutorNotFoundError],
|
||||
) -> None:
|
||||
from superset.models.dashboard import Dashboard
|
||||
from superset.models.slice import Slice
|
||||
from superset.reports.models import ReportSchedule
|
||||
from superset.tasks.utils import get_executor
|
||||
|
||||
model: Type[Union[Dashboard, ReportSchedule, Slice]]
|
||||
model_kwargs: Dict[str, Any] = {}
|
||||
model: type[Union[Dashboard, ReportSchedule, Slice]]
|
||||
model_kwargs: dict[str, Any] = {}
|
||||
if model_type == ModelType.REPORT_SCHEDULE:
|
||||
model = ReportSchedule
|
||||
model_kwargs = {
|
||||
|
||||
Reference in New Issue
Block a user