MCPcopy Create free account
hub / github.com/ScrapeGraphAI/toonify / example_exclude_options

Function example_exclude_options

examples/pydantic_usage.py:125–149  ·  view source on GitHub ↗

Example: Using exclude options.

()

Source from the content-addressed store, hash-verified

123
124
125def example_exclude_options():
126 """Example: Using exclude options."""
127 print("=== Exclude Options ===")
128
129 user = User(
130 id=3,
131 name='Charlie Brown',
132 email='charlie@example.com'
133 # age, active, and address use defaults or are None
134 )
135
136 print("All fields (default):")
137 toon_all = encode_pydantic(user, exclude_unset=False)
138 print(toon_all)
139 print()
140
141 print("Exclude unset fields:")
142 toon_unset = encode_pydantic(user, exclude_unset=True)
143 print(toon_unset)
144 print()
145
146 print("Exclude None values:")
147 toon_none = encode_pydantic(user, exclude_none=True)
148 print(toon_none)
149 print()
150
151
152def example_field_aliases():

Callers 1

pydantic_usage.pyFile · 0.85

Calls 2

encode_pydanticFunction · 0.90
UserClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…