mirror of
https://github.com/apache/superset.git
synced 2026-04-25 19:14:27 +00:00
chore(pre-commit): Add pyupgrade and pycln hooks (#24197)
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
import json
|
||||
import unittest
|
||||
from io import BytesIO
|
||||
from typing import List, Optional
|
||||
from typing import Optional
|
||||
from unittest.mock import ANY, patch
|
||||
from zipfile import is_zipfile, ZipFile
|
||||
|
||||
@@ -68,7 +68,7 @@ class TestDatasetApi(SupersetTestCase):
|
||||
@staticmethod
|
||||
def insert_dataset(
|
||||
table_name: str,
|
||||
owners: List[int],
|
||||
owners: list[int],
|
||||
database: Database,
|
||||
sql: Optional[str] = None,
|
||||
schema: Optional[str] = None,
|
||||
@@ -94,7 +94,7 @@ class TestDatasetApi(SupersetTestCase):
|
||||
"ab_permission", [self.get_user("admin").id], get_main_database()
|
||||
)
|
||||
|
||||
def get_fixture_datasets(self) -> List[SqlaTable]:
|
||||
def get_fixture_datasets(self) -> list[SqlaTable]:
|
||||
return (
|
||||
db.session.query(SqlaTable)
|
||||
.options(joinedload(SqlaTable.database))
|
||||
@@ -102,7 +102,7 @@ class TestDatasetApi(SupersetTestCase):
|
||||
.all()
|
||||
)
|
||||
|
||||
def get_fixture_virtual_datasets(self) -> List[SqlaTable]:
|
||||
def get_fixture_virtual_datasets(self) -> list[SqlaTable]:
|
||||
return (
|
||||
db.session.query(SqlaTable)
|
||||
.filter(SqlaTable.table_name.in_(self.fixture_virtual_table_names))
|
||||
@@ -410,13 +410,11 @@ class TestDatasetApi(SupersetTestCase):
|
||||
)
|
||||
all_datasets = db.session.query(SqlaTable).all()
|
||||
schema_values = sorted(
|
||||
set(
|
||||
[
|
||||
dataset.schema
|
||||
for dataset in all_datasets
|
||||
if dataset.schema is not None
|
||||
]
|
||||
)
|
||||
{
|
||||
dataset.schema
|
||||
for dataset in all_datasets
|
||||
if dataset.schema is not None
|
||||
}
|
||||
)
|
||||
expected_response = {
|
||||
"count": len(schema_values),
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from operator import itemgetter
|
||||
from typing import Any, List
|
||||
from typing import Any
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
@@ -312,7 +312,7 @@ class TestImportDatasetsCommand(SupersetTestCase):
|
||||
assert len(dataset.metrics) == 2
|
||||
assert dataset.main_dttm_col == "ds"
|
||||
assert dataset.filter_select_enabled
|
||||
assert set(col.column_name for col in dataset.columns) == {
|
||||
assert {col.column_name for col in dataset.columns} == {
|
||||
"num_california",
|
||||
"ds",
|
||||
"state",
|
||||
@@ -526,7 +526,7 @@ class TestImportDatasetsCommand(SupersetTestCase):
|
||||
db.session.commit()
|
||||
|
||||
|
||||
def _get_table_from_list_by_name(name: str, tables: List[Any]):
|
||||
def _get_table_from_list_by_name(name: str, tables: list[Any]):
|
||||
for table in tables:
|
||||
if table.table_name == name:
|
||||
return table
|
||||
|
||||
Reference in New Issue
Block a user