MCPcopy
hub / github.com/PrefectHQ/prefect / model_dump

Method model_dump

src/prefect/blocks/core.py:2081–2121  ·  view source on GitHub ↗
(
        self,
        *,
        mode: Literal["json", "python"] | str = "python",
        include: "IncEx | None" = None,
        exclude: "IncEx | None" = None,
        context: dict[str, Any] | None = None,
        by_alias: bool = False,
        exclude_unset: bool = False,
        exclude_defaults: bool = False,
        exclude_none: bool = False,
        round_trip: bool = False,
        warnings: bool | Literal["none", "warn", "error"] = True,
        serialize_as_any: bool = False,
    )

Source from the content-addressed store, hash-verified

2079 )
2080
2081 def model_dump(
2082 self,
2083 *,
2084 mode: Literal["json", "python"] | str = "python",
2085 include: "IncEx | None" = None,
2086 exclude: "IncEx | None" = None,
2087 context: dict[str, Any] | None = None,
2088 by_alias: bool = False,
2089 exclude_unset: bool = False,
2090 exclude_defaults: bool = False,
2091 exclude_none: bool = False,
2092 round_trip: bool = False,
2093 warnings: bool | Literal["none", "warn", "error"] = True,
2094 serialize_as_any: bool = False,
2095 ) -> dict[str, Any]:
2096 d = super().model_dump(
2097 mode=mode,
2098 include=include,
2099 exclude=exclude,
2100 context=context,
2101 by_alias=by_alias,
2102 exclude_unset=exclude_unset,
2103 exclude_defaults=exclude_defaults,
2104 exclude_none=exclude_none,
2105 round_trip=round_trip,
2106 warnings=warnings,
2107 serialize_as_any=serialize_as_any,
2108 )
2109
2110 extra_serializer_fields = {
2111 "block_type_slug",
2112 "_block_document_id",
2113 "_block_document_name",
2114 "_is_anonymous",
2115 }.intersection(d.keys())
2116
2117 for field in extra_serializer_fields:
2118 if (include and field not in include) or (exclude and field in exclude):
2119 d.pop(field)
2120
2121 return d

Callers 15

_to_block_documentMethod · 0.95
serializeMethod · 0.45
serializeMethod · 0.45
serializeMethod · 0.45
serializeMethod · 0.45
asset_as_resourceMethod · 0.45
serializeMethod · 0.45
acreateMethod · 0.45
createMethod · 0.45
aupdateMethod · 0.45
updateMethod · 0.45
areadMethod · 0.45

Calls 2

keysMethod · 0.45
popMethod · 0.45