MCPcopy
hub / github.com/pydantic/pydantic / is_pydantic_dataclass

Function is_pydantic_dataclass

pydantic/dataclasses.py:401–413  ·  view source on GitHub ↗

Whether a class is a pydantic dataclass. Args: class_: The class. Returns: `True` if the class is a pydantic dataclass, `False` otherwise.

(class_: type[Any], /)

Source from the content-addressed store, hash-verified

399
400
401def is_pydantic_dataclass(class_: type[Any], /) -> TypeGuard[type[PydanticDataclass]]:
402 """Whether a class is a pydantic dataclass.
403
404 Args:
405 class_: The class.
406
407 Returns:
408 `True` if the class is a pydantic dataclass, `False` otherwise.
409 """
410 try:
411 return '__is_pydantic_dataclass__' in class_.__dict__ and dataclasses.is_dataclass(class_)
412 except AttributeError:
413 return False

Callers 3

pretty_print_core_schemaFunction · 0.90
_dataclass_schemaMethod · 0.85

Calls

no outgoing calls

Tested by 1