MCPcopy Create free account
hub / github.com/ipython/traitlets / class_of

Function class_of

traitlets/utils/descriptions.py:134–142  ·  view source on GitHub ↗

Returns a string of the value's type with an indefinite article. For example 'an Image' or 'a PlotValue'.

(value: Any)

Source from the content-addressed store, hash-verified

132
133
134def class_of(value: Any) -> Any:
135 """Returns a string of the value's type with an indefinite article.
136
137 For example 'an Image' or 'a PlotValue'.
138 """
139 if inspect.isclass(value):
140 return add_article(value.__name__)
141 else:
142 return class_of(type(value))
143
144
145def add_article(name: str, definite: bool = False, capital: bool = False) -> str:

Callers 7

errorMethod · 0.85
_validate_boundsFunction · 0.85
validateMethod · 0.85
length_errorMethod · 0.85
length_errorMethod · 0.85
validate_elementsMethod · 0.85
element_errorMethod · 0.85

Calls 1

add_articleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…