mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
chore(pre-commit): Add pyupgrade and pycln hooks (#24197)
This commit is contained in:
@@ -21,7 +21,7 @@ import pickle
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass
|
||||
from enum import Enum
|
||||
from typing import Any, Optional, TypedDict
|
||||
from typing import Any, TypedDict
|
||||
from uuid import UUID
|
||||
|
||||
from marshmallow import Schema, ValidationError
|
||||
@@ -34,14 +34,14 @@ from superset.key_value.exceptions import (
|
||||
|
||||
@dataclass
|
||||
class Key:
|
||||
id: Optional[int]
|
||||
uuid: Optional[UUID]
|
||||
id: int | None
|
||||
uuid: UUID | None
|
||||
|
||||
|
||||
class KeyValueFilter(TypedDict, total=False):
|
||||
resource: str
|
||||
id: Optional[int]
|
||||
uuid: Optional[UUID]
|
||||
id: int | None
|
||||
uuid: UUID | None
|
||||
|
||||
|
||||
class KeyValueResource(str, Enum):
|
||||
|
||||
@@ -18,7 +18,7 @@ from __future__ import annotations
|
||||
|
||||
from hashlib import md5
|
||||
from secrets import token_urlsafe
|
||||
from typing import Any, Union
|
||||
from typing import Any
|
||||
from uuid import UUID, uuid3
|
||||
|
||||
import hashids
|
||||
@@ -35,7 +35,7 @@ def random_key() -> str:
|
||||
return token_urlsafe(48)
|
||||
|
||||
|
||||
def get_filter(resource: KeyValueResource, key: Union[int, UUID]) -> KeyValueFilter:
|
||||
def get_filter(resource: KeyValueResource, key: int | UUID) -> KeyValueFilter:
|
||||
try:
|
||||
filter_: KeyValueFilter = {"resource": resource.value}
|
||||
if isinstance(key, UUID):
|
||||
|
||||
Reference in New Issue
Block a user