| 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 |