chore(pre-commit): Add pyupgrade and pycln hooks (#24197)

This commit is contained in:
John Bodley
2023-06-01 12:01:10 -07:00
committed by GitHub
parent 7d7ce63970
commit a4d5d7c6b9
448 changed files with 3084 additions and 3305 deletions

View File

@@ -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),

View File

@@ -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