MCPcopy Create free account
hub / github.com/apache/arrow / add_optional_command

Function add_optional_command

dev/archery/archery/utils/cli.py:54–73  ·  view source on GitHub ↗
(name, module, function, parent)

Source from the content-addressed store, hash-verified

52
53
54def add_optional_command(name, module, function, parent):
55 try:
56 module = importlib.import_module(module, package="archery")
57 command = getattr(module, function)
58 except ImportError as exc:
59 error_message = exc.name
60
61 @parent.command(
62 name,
63 context_settings={
64 "allow_extra_args": True,
65 "ignore_unknown_options": True,
66 }
67 )
68 def command():
69 raise click.ClickException(
70 f"Couldn't import command `{name}` due to {error_message}"
71 )
72 else:
73 parent.add_command(command)

Callers 1

cli.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected