MCPcopy
hub / github.com/msgspec/msgspec / _get_doc

Function _get_doc

src/msgspec/_json_schema.py:170–183  ·  view source on GitHub ↗
(t: mi.Type)

Source from the content-addressed store, hash-verified

168
169
170def _get_doc(t: mi.Type) -> str:
171 assert hasattr(t, "cls")
172 cls = getattr(t.cls, "__origin__", t.cls)
173 doc = getattr(cls, "__doc__", "")
174 if not doc:
175 return ""
176 doc = textwrap.dedent(doc).strip("\r\n")
177 if isinstance(t, mi.EnumType):
178 if doc == "An enumeration.":
179 return ""
180 elif isinstance(t, (mi.NamedTupleType, mi.DataclassType)):
181 if doc.startswith(f"{cls.__name__}(") and doc.endswith(")"):
182 return ""
183 return doc
184
185
186def _build_name_map(component_types: dict[Any, mi.Type]) -> dict[Any, str]:

Callers 1

to_schemaMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…