MCPcopy Index your code
hub / github.com/hugapi/hug / __call__

Method __call__

hug/api.py:432–444  ·  view source on GitHub ↗

Routes to the correct command line tool

(self, args=None)

Source from the content-addressed store, hash-verified

430 self.error_exit_codes = error_exit_codes
431
432 def __call__(self, args=None):
433 """Routes to the correct command line tool"""
434 self.api._ensure_started()
435 args = sys.argv if args is None else args
436 if not len(args) > 1 or not args[1] in self.commands:
437 print(str(self))
438 return sys.exit(1)
439
440 command = args.pop(1)
441 result = self.commands.get(command)()
442
443 if self.error_exit_codes and bool(strtobool(result.decode("utf-8"))) is False:
444 sys.exit(1)
445
446 def handlers(self):
447 """Returns all registered handlers attached to this API"""

Callers 1

__call__Method · 0.45

Calls 3

_ensure_startedMethod · 0.80
exitMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected