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
from typing import Any
from marshmallow import fields, post_load, pre_load, Schema, validate
from typing_extensions import TypedDict
@@ -76,7 +76,7 @@ class SamplesPayloadSchema(Schema):
@pre_load
# pylint: disable=no-self-use, unused-argument
def handle_none(self, data: Dict[str, Any], **kwargs: Any) -> Dict[str, Any]:
def handle_none(self, data: dict[str, Any], **kwargs: Any) -> dict[str, Any]:
if data is None:
return {}
return data

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 superset import app, db
from superset.common.chart_data import ChartDataResultType
@@ -27,7 +27,7 @@ from superset.utils.core import QueryStatus
from superset.views.datasource.schemas import SamplesPayloadSchema
def get_limit_clause(page: Optional[int], per_page: Optional[int]) -> Dict[str, int]:
def get_limit_clause(page: Optional[int], per_page: Optional[int]) -> dict[str, int]:
samples_row_limit = app.config.get("SAMPLES_ROW_LIMIT", 1000)
limit = samples_row_limit
offset = 0
@@ -50,7 +50,7 @@ def get_samples( # pylint: disable=too-many-arguments,too-many-locals
page: int = 1,
per_page: int = 1000,
payload: Optional[SamplesPayloadSchema] = None,
) -> Dict[str, Any]:
) -> dict[str, Any]:
datasource = DatasourceDAO.get_datasource(
session=db.session,
datasource_type=datasource_type,