mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
Some dataclass implementations, such as Pydantic, allow declaring fields with mutable defaults, deep-copying them under the hood. See https://docs.pydantic.dev/latest/concepts/models/#fields-with-non-hashable-default-values (cherry picked from commit e495621858950976226731dddbb01af4012704fa) IJ-CR-151192 GitOrigin-RevId: 7412272584a4c26e404d3d84e6150f974027eca7
26 lines
643 B
Python
26 lines
643 B
Python
from collections import OrderedDict
|
|
from typing import ClassVar
|
|
|
|
from decorator import my_dataclass, field
|
|
|
|
|
|
@my_dataclass()
|
|
class A:
|
|
a: list[int] = []
|
|
b: list[int] = list()
|
|
c: set[int] = {1}
|
|
d: set[int] = set()
|
|
e: tuple[int, ...] = ()
|
|
f: tuple[int, ...] = tuple()
|
|
g: ClassVar[list[int]] = []
|
|
h: ClassVar = []
|
|
i: dict[int, int] = {1: 2}
|
|
j: dict[int, int] = dict()
|
|
k = []
|
|
l = list()
|
|
m: dict[int, int] = OrderedDict()
|
|
n: frozenset[int] = frozenset()
|
|
o: list = field(default_factory=list)
|
|
a2: type[list[int]] = list
|
|
b2: type[set[int]] = set
|
|
c2: type[tuple[int, ...]] = tuple |