mirror of
https://github.com/aclist/dztui.git
synced 2026-11-12 13:00:37 +01:00
10 lines
321 B
Python
10 lines
321 B
Python
from dataclasses import dataclass
|
|
from typing import Callable
|
|
|
|
def immutable_dataclass(cls: type | None = None, **kwargs: bool) -> type | Callable[[type], type]:
|
|
kwargs["slots"] = True
|
|
kwargs["frozen"] = True
|
|
if cls is None:
|
|
return lambda c: dataclass(c, **kwargs)
|
|
return dataclass(cls, **kwargs)
|