MCPcopy
hub / github.com/hugapi/hug / accept

Function accept

hug/types.py:211–219  ·  view source on GitHub ↗

Allows quick wrapping of any Python type cast function for use as a hug type annotation

(kind, doc=None, error_text=None, exception_handlers=empty.dict, accept_context=False)

Source from the content-addressed store, hash-verified

209
210
211def accept(kind, doc=None, error_text=None, exception_handlers=empty.dict, accept_context=False):
212 """Allows quick wrapping of any Python type cast function for use as a hug type annotation"""
213 return create(
214 doc,
215 error_text,
216 exception_handlers=exception_handlers,
217 chain=False,
218 accept_context=accept_context,
219 )(kind)
220
221
222number = accept(int, "A whole number", "Invalid whole number provided")

Callers 1

types.pyFile · 0.70

Calls 1

createFunction · 0.85

Tested by

no test coverage detected