Skip to content

Instantly share code, notes, and snippets.

from __future__ import annotations
from dataclasses import is_dataclass
import threading
import weakref
from typing import Any, Callable, ClassVar, Dict, Optional, Tuple, Type
NormalizeFn = Callable[[Type[Any], Tuple[Any, ...], Dict[str, Any]], Tuple[Tuple[Any, ...], Dict[str, Any]]]
"""
Usage:
```
class Sample(metaclass=Subscriptable): ...
Sample['key1'] = "value1"
print(Sample['key1']) # value1
```