Skip to content

Commit

Permalink
Modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed May 7, 2024
1 parent 1675691 commit b4b20b3
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions panel/esm.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

from collections import defaultdict
from typing import (
TYPE_CHECKING, Any, Callable, ClassVar, Dict, List, Literal, Mapping,
Optional, Tuple, Type,
TYPE_CHECKING, Any, Callable, ClassVar, Literal, Mapping, Optional,
)

import param
Expand All @@ -33,7 +32,7 @@

class ReactiveESMMetaclass(ReactiveMetaBase):

def __init__(mcs, name: str, bases: Tuple[Type, ...], dict_: Mapping[str, Any]):
def __init__(mcs, name: str, bases: tuple[type, ...], dict_: Mapping[str, Any]):
mcs.__original_doc__ = mcs.__doc__
ParameterizedMetaclass.__init__(mcs, name, bases, dict_)

Expand Down Expand Up @@ -82,7 +81,7 @@ class CounterButton(pn.ReactiveESM):

_esm: ClassVar[str | os.PathLike] = ""

_import_map: ClassVar[Dict[str, Dict[Literal['imports', 'scopes'], str]]] = {}
_import_map: ClassVar[dict[str, dict[Literal['imports', 'scopes'], str]]] = {}

__abstract = True

Expand Down Expand Up @@ -119,10 +118,10 @@ async def _watch_esm(self):
self._apply_update({}, {'esm': self._render_esm()}, model, ref)

@property
def _linked_properties(self) -> List[str]:
def _linked_properties(self) -> list[str]:
return [p for p in self._data_model.properties() if p not in ('js_property_callbacks',)]

def _init_params(self) -> Dict[str, Any]:
def _init_params(self) -> dict[str, Any]:
ignored = list(Reactive.param)
params = {
p : getattr(self, p) for p in list(Layoutable.param)
Expand Down Expand Up @@ -202,7 +201,7 @@ def _process_event(self, event: 'Event') -> None:
cb(event)

def _update_model(
self, events: Dict[str, param.parameterized.Event], msg: Dict[str, Any],
self, events: dict[str, param.parameterized.Event], msg: dict[str, Any],
root: Model, model: Model, doc: Document, comm: Optional[Comm]
) -> None:
model_msg, data_msg = {}, {}
Expand Down

0 comments on commit b4b20b3

Please sign in to comment.