Skip to content

Commit

Permalink
Merge branch 'master' into serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
emilhe committed Jul 31, 2023
2 parents 6a558e1 + d1a911a commit df6f3c8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions dash_extensions/enrich.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@
from flask_caching.backends import FileSystemCache, RedisCache
from more_itertools import flatten
from collections import defaultdict
from typing import Dict, Callable, List, Union, Any, Tuple, Optional
from typing import Dict, Callable, List, Union, Any, Tuple, Optional, Generic, TypeVar
from datetime import datetime
from dash_extensions import CycleBreaker
from dataclass_wizard import fromdict, asdict

T = TypeVar("T")

_wildcard_mappings = {ALL: "<ALL>", MATCH: "<MATCH>", ALLSMALLER: "<ALLSMALLER>"}
_wildcard_values = list(_wildcard_mappings.values())

Expand Down Expand Up @@ -1210,9 +1212,9 @@ def _try_dump(self, obj: Any) -> Any:
return f"{self.prefix}{json.dumps(data)}"


class Serverside:
class Serverside(Generic[T]):

def __init__(self, value: Any, key: str = None, backend: Union[ServersideBackend, str, None] = None):
def __init__(self, value: T, key: str = None, backend: Union[ServersideBackend, str, None] = None):
self.value = value
self.key: str = str(uuid.uuid4()) if key is None else key
self.backend_uid: str = backend.uid if isinstance(backend, ServersideBackend) else backend
Expand Down
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit df6f3c8

Please sign in to comment.