MCPcopy
hub / github.com/python-attrs/attrs / _IsCallableValidator

Class _IsCallableValidator

src/attr/validators.py:295–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293
294@attrs(repr=False, slots=False, unsafe_hash=True)
295class _IsCallableValidator:
296 def __call__(self, inst, attr, value):
297 """
298 We use a callable class to be able to change the ``__repr__``.
299 """
300 if not callable(value):
301 message = (
302 "'{name}' must be callable "
303 "(got {value!r} that is a {actual!r})."
304 )
305 raise NotCallableError(
306 msg=message.format(
307 name=attr.name, value=value, actual=value.__class__
308 ),
309 value=value,
310 )
311
312 def __repr__(self):
313 return "<is_callable validator>"
314
315
316def is_callable():

Callers 1

is_callableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected