summaryrefslogtreecommitdiff
path: root/venv/lib/python3.11/site-packages/msgspec/structs.pyi
blob: 58432b2d7bf971139e9a193928c9622a4953569f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from typing import Any, TypeVar, Union

from . import NODEFAULT, Struct

S = TypeVar("S", bound=Struct)

def replace(struct: S, /, **changes: Any) -> S: ...
def asdict(struct: Struct) -> dict[str, Any]: ...
def astuple(struct: Struct) -> tuple[Any, ...]: ...
def force_setattr(struct: Struct, name: str, value: Any) -> None: ...

class StructConfig:
    frozen: bool
    eq: bool
    order: bool
    array_like: bool
    gc: bool
    repr_omit_defaults: bool
    omit_defaults: bool
    forbid_unknown_fields: bool
    weakref: bool
    dict: bool
    cache_hash: bool
    tag: Union[str, int, None]
    tag_field: Union[str, None]

class FieldInfo(Struct):
    name: str
    encode_name: str
    type: Any
    default: Any = NODEFAULT
    default_factory: Any = NODEFAULT

    @property
    def required(self) -> bool: ...

def fields(type_or_instance: Struct | type[Struct]) -> tuple[FieldInfo]: ...