MCPcopy Create free account
hub / github.com/python-cmd2/cmd2 / __contains__

Method __contains__

cmd2/cmd2.py:257–264  ·  view source on GitHub ↗

Return whether a given method's parser is in self. If the parser does not yet exist, it will be created if applicable. This is basically for checking if a method is argarse-based.

(self, command_method: BoundCommandFunc)

Source from the content-addressed store, hash-verified

255 return ""
256
257 def __contains__(self, command_method: BoundCommandFunc) -> bool:
258 """Return whether a given method's parser is in self.
259
260 If the parser does not yet exist, it will be created if applicable.
261 This is basically for checking if a method is argarse-based.
262 """
263 parser = self.get(command_method)
264 return bool(parser)
265
266 def get(self, command_method: BoundCommandFunc) -> Cmd2ArgumentParser | None:
267 """Return a given method's parser or None if the method is not argparse-based.

Callers

nothing calls this directly

Calls 1

getMethod · 0.95

Tested by

no test coverage detected