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

@@ -15,8 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from collections.abc import Iterator
from datetime import datetime, timezone
from typing import Iterator, Tuple
import yaml
@@ -36,7 +36,7 @@ class ExportAssetsCommand(BaseCommand):
Command that exports all databases, datasets, charts, dashboards and saved queries.
"""
def run(self) -> Iterator[Tuple[str, str]]:
def run(self) -> Iterator[tuple[str, str]]:
metadata = {
"version": EXPORT_VERSION,
"type": "assets",

View File

@@ -15,8 +15,8 @@
# specific language governing permissions and limitations
# under the License.
from collections.abc import Iterator
from datetime import datetime, timezone
from typing import Iterator, List, Tuple, Type
import yaml
from flask_appbuilder import Model
@@ -30,21 +30,21 @@ METADATA_FILE_NAME = "metadata.yaml"
class ExportModelsCommand(BaseCommand):
dao: Type[BaseDAO] = BaseDAO
not_found: Type[CommandException] = CommandException
dao: type[BaseDAO] = BaseDAO
not_found: type[CommandException] = CommandException
def __init__(self, model_ids: List[int], export_related: bool = True):
def __init__(self, model_ids: list[int], export_related: bool = True):
self.model_ids = model_ids
self.export_related = export_related
# this will be set when calling validate()
self._models: List[Model] = []
self._models: list[Model] = []
@staticmethod
def _export(model: Model, export_related: bool = True) -> Iterator[Tuple[str, str]]:
def _export(model: Model, export_related: bool = True) -> Iterator[tuple[str, str]]:
raise NotImplementedError("Subclasses MUST implement _export")
def run(self) -> Iterator[Tuple[str, str]]:
def run(self) -> Iterator[tuple[str, str]]:
self.validate()
metadata = {