PrivateAttr
Indicates that an attribute is intended for private use and not handled during normal validation/serialization.
def PrivateAttr(
default: Any = PydanticUndefined,
default_factory: Callable[[], Any] | Callable[[dict[str, Any]], Any] | None = None,
init: Literal[False] = False
) - > ModelPrivateAttr
Indicates that an attribute is intended for private use and not handled during normal validation/serialization.
Parameters
| Name | Type | Description |
|---|---|---|
| default | Any = PydanticUndefined | The attribute's default value used when no value is provided during model initialization. |
| default_factory | `Callable[[], Any] | Callable[[dict[str, Any]], Any] |
| init | Literal[False] = False | Whether the attribute should be included in the constructor of the dataclass. Always False. |
Returns
| Type | Description |
|---|---|
ModelPrivateAttr | An instance of ModelPrivateAttr class used to define private model state. |