MCPcopy Index your code
hub / github.com/python/cpython / _check_callback

Method _check_callback

Lib/optparse.py:695–720  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

693 self)
694
695 def _check_callback(self):
696 if self.action == "callback":
697 if not callable(self.callback):
698 raise OptionError(
699 "callback not callable: %r" % self.callback, self)
700 if (self.callback_args is not None and
701 not isinstance(self.callback_args, tuple)):
702 raise OptionError(
703 "callback_args, if supplied, must be a tuple: not %r"
704 % self.callback_args, self)
705 if (self.callback_kwargs is not None and
706 not isinstance(self.callback_kwargs, dict)):
707 raise OptionError(
708 "callback_kwargs, if supplied, must be a dict: not %r"
709 % self.callback_kwargs, self)
710 else:
711 if self.callback is not None:
712 raise OptionError(
713 "callback supplied (%r) for non-callback option"
714 % self.callback, self)
715 if self.callback_args is not None:
716 raise OptionError(
717 "callback_args supplied for non-callback option", self)
718 if self.callback_kwargs is not None:
719 raise OptionError(
720 "callback_kwargs supplied for non-callback option", self)
721
722
723 CHECK_METHODS = [_check_action,

Callers

nothing calls this directly

Calls 1

OptionErrorClass · 0.85

Tested by

no test coverage detected