Home / Function/ is_pydantic_v1_model_instance() — fastapi Function Reference

is_pydantic_v1_model_instance() — fastapi Function Reference

Architecture documentation for the is_pydantic_v1_model_instance() function in shared.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  6598ef7b_c8de_afd2_19f8_8a88b5fb5900["is_pydantic_v1_model_instance()"]
  3e898b29_4dd8_c417_2d9b_a84d867423b4["shared.py"]
  6598ef7b_c8de_afd2_19f8_8a88b5fb5900 -->|defined in| 3e898b29_4dd8_c417_2d9b_a84d867423b4
  style 6598ef7b_c8de_afd2_19f8_8a88b5fb5900 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

fastapi/_compat/shared.py lines 180–189

def is_pydantic_v1_model_instance(obj: Any) -> bool:
    # TODO: remove this function once the required version of Pydantic fully
    # removes pydantic.v1
    try:
        with warnings.catch_warnings():
            warnings.simplefilter("ignore", UserWarning)
            from pydantic import v1
    except ImportError:  # pragma: no cover
        return False
    return isinstance(obj, v1.BaseModel)

Domain

Subdomains

Frequently Asked Questions

What does is_pydantic_v1_model_instance() do?
is_pydantic_v1_model_instance() is a function in the fastapi codebase, defined in fastapi/_compat/shared.py.
Where is is_pydantic_v1_model_instance() defined?
is_pydantic_v1_model_instance() is defined in fastapi/_compat/shared.py at line 180.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free