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

@@ -14,7 +14,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from typing import Any, Dict, Optional
from typing import Any, Optional
from unittest.mock import Mock, patch
from pytest import fixture, mark
@@ -23,7 +23,7 @@ from superset.common.query_object_factory import QueryObjectFactory
from tests.common.query_context_generator import QueryContextGenerator
def create_app_config() -> Dict[str, Any]:
def create_app_config() -> dict[str, Any]:
return {
"ROW_LIMIT": 5000,
"DEFAULT_RELATIVE_START_TIME": "today",
@@ -34,7 +34,7 @@ def create_app_config() -> Dict[str, Any]:
@fixture
def app_config() -> Dict[str, Any]:
def app_config() -> dict[str, Any]:
return create_app_config().copy()
@@ -58,7 +58,7 @@ def apply_max_row_limit(limit: int, max_limit: Optional[int] = None) -> int:
@fixture
def query_object_factory(
app_config: Dict[str, Any], connector_registry: Mock, session_factory: Mock
app_config: dict[str, Any], connector_registry: Mock, session_factory: Mock
) -> QueryObjectFactory:
import superset.common.query_object_factory as mod
@@ -67,7 +67,7 @@ def query_object_factory(
@fixture
def raw_query_context() -> Dict[str, Any]:
def raw_query_context() -> dict[str, Any]:
return QueryContextGenerator().generate("birth_names")
@@ -75,7 +75,7 @@ class TestQueryObjectFactory:
def test_query_context_limit_and_offset_defaults(
self,
query_object_factory: QueryObjectFactory,
raw_query_context: Dict[str, Any],
raw_query_context: dict[str, Any],
):
raw_query_object = raw_query_context["queries"][0]
raw_query_object.pop("row_limit", None)
@@ -89,7 +89,7 @@ class TestQueryObjectFactory:
def test_query_context_limit(
self,
query_object_factory: QueryObjectFactory,
raw_query_context: Dict[str, Any],
raw_query_context: dict[str, Any],
):
raw_query_object = raw_query_context["queries"][0]
raw_query_object["row_limit"] = 100
@@ -104,7 +104,7 @@ class TestQueryObjectFactory:
def test_query_context_null_post_processing_op(
self,
query_object_factory: QueryObjectFactory,
raw_query_context: Dict[str, Any],
raw_query_context: dict[str, Any],
):
raw_query_object = raw_query_context["queries"][0]
raw_query_object["post_processing"] = [None]