Use basedpyright refactor
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
import dataclasses
|
||||
from typing import Optional, TypeVar
|
||||
from typing import TypeVar
|
||||
|
||||
from typing_extensions import override
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class WithId:
|
||||
id: Optional[int]
|
||||
id: int | None
|
||||
|
||||
|
||||
T = TypeVar("T", bound=WithId)
|
||||
|
||||
|
||||
class IndexedList(list[T]):
|
||||
@override
|
||||
def append(self, _item: T) -> None:
|
||||
if _item.id is None:
|
||||
_item.id = max((i.id or 0 for i in self), default=0) + 1
|
||||
|
||||
Reference in New Issue
Block a user